In the past, I've successfully preserved view state by utilizing a service to store it in an object.
Instead of storing references to specific fields (such as sort columns in a table or values in certain fields) in the controller/scope, I would save them in the view state object of the service.
Upon initialization, the controller would determine if it was a new search by checking the 'source' or 'type' of page transfer through a URL parameter or state (e.g. #/search?type=new). If it was indeed a new search, the values would be reset; otherwise, the previously used values would be displayed and utilized.
Whenever the application reloaded, the data in the Service would be cleared, creating a fresh form.
The method mentioned above is straightforward because Angular takes care of the saving process for you. Services being singletons means that by directly binding to the service's fields, they will persist through route changes automatically.
In your view:
<input ng-model="criteria.firstName">
During controller initialization:
$scope.criteria = ViewStateService.criteria;
If you prefer to save view state only at specific points, you can set up an event handler on page change/route change events to copy the data at those junctures.
$scope.$on('$locationChangeStart', function(next, current) {
//code to copy/save desired fields to the Service.
});
how to watch for a route change in angularjs