Reputation: 11632
I would like to return user form detail page to previous page (list of users).
If i try to click to back button in the browser, app request is processed via app router and list page is reloaded again.
I would like to add back button into detail which return user to previous page without reload method in ng-init.
Is it possible? And if yes, how to easily solve it?
Thanks for any help.
Upvotes: 1
Views: 1469
Reputation: 21
In your app.config enable HTML5 push state through
$locationProvider.html5Mode(true);
$locationProvider.hashPrefix('!');
(Make sure to inject $locationProvider)
Now you can watch the location change events and can update your view accordingly using - $locationChangeStart - $locationChangeSuccess
Also you can change the route using $location.path(), $location.url() on your back button.
View this link for reference https://docs.angularjs.org/api/ng/service/$location
Upvotes: 2