In my application, from one controller i am updating $scope.needs.Then when i click a button, it is going to another controller. There i am getting the updated value of $scope.needs. But when click on back button, it is going to the previous controller. There i am not getting the updated value of $scope.needs. How to solve this issue.
This is the first controller.
function CommitmentCtrl($scope, $routeParams, $http, UIData, cust, productList) {
$scope.needs = $scope.customer.priorities.list;
}
In this controller
$scope.increment = function(index) {
$scope.needs[index].commitment = parseFloat ($('#custom_commitment_'+index).val()) + 1000;
}
Here $scope.needs updated..rite? Then when click on button,the below function is called
$scope.gotoSummary = function(){
$scope.customer.priorities.list = $scope.needs;
}
Here $scope.customer.priorities.list contains the updated value.
This is the next controller
function SummaryCtrl($scope, $routeParams, $http, UIData, cust) {
$scope.$parent.needs = $scope.customer.priorities.list;
}
Then click on back button invokes the first controller,but there in $scope,updated value is not there.
How do I update $scope.needs in both places?