简体   繁体   中英

Back to previous page without reload

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM