I my angular app, I have a list of items shown in one page and on clicking continue button, the app will move to another state
. In that page there is a "Back" button which has the code $state.go('prevPage')
on ng-click
event. But on coming back all the data are cleared. Is there any way I can keep the scope variables alive on returning back ?
Update
What I tried..
On going to another state, saved all the scope data in a service
returnItemModel.saveReturnData($scope);
While coming back retrived it and assigned it to scope and I call the digest cycle.
var savedReturnData = returnItemModel.restoreReturnData();
if(savedReturnData){
$scope = savedReturnData;
$scope.$apply();
}
This is not working. Does someone know the reason.