Reputation: 6387
I am working on a mobile version for my site. I have a main view with a table of jobs. On my desktop version I share data between views and modals fine but I cant seem to understand how to share from a view to another view. they both are on the same controller. I need to be able to populate the second view with all the properties of the object. plunkr
//Pass Data to view two
$scope.editJob = function () {
$location.path('/editJob');
};
view one
<table>
<tr>
<td ng-click="editJob(employee)">{{employee.Address}}</td>
</tr>
</table>
view two
<input type="text" ng-model="FavoriteFood"/>
Upvotes: 0
Views: 122
Reputation: 15931
When you change the app's location the controller reloads, losing all of it's state. So, you can either put the data you want shared in a service, or investigate an alternate way of switching views (maybe ui-router or ng-include for instance)
Upvotes: 1