简体   繁体   中英

what is the best practice to reload AngularJS page

I need to know what is best practice to work with Auth Service and authInterceptor Service

 $window.location.reload();
 $scope.$apply();
 $location.path('/');  

I have used this in my application to rerender the data.if you are in the same state as well you will be able to rerender the data. $state.transitionTo('app.emp.nav.portfolio', null, {'reload':true});

Using $location.path('/') in some cases could be useless because AngularJS won't refresh the controller if location doesn't change.

You should try to use this statement to re-render the page

$route.reload();

Remember to inject $route in your controller.

Also you can see AngularJS documentation about this: AngularJS: API: $route

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