[英]What is the best practice for maintain a menu after a page reload? I have this custom code which feels wrong
[英]what is the best practice to reload AngularJS page
我需要知道与Auth Service和authInterceptor Service一起使用的最佳实践
$window.location.reload();
$scope.$apply();
$location.path('/');
我已经在我的应用程序中使用过此功能来重新渲染数据。如果您也处于相同状态,则可以重新渲染数据。 $state.transitionTo('app.emp.nav.portfolio', null, {'reload':true});
在某些情况下使用$location.path('/')
可能没有用,因为如果位置不变,AngularJS不会刷新控制器。
您应该尝试使用此语句重新呈现页面
$route.reload();
请记住在控制器中注入$route
。
您也可以查看有关以下内容的AngularJS文档: AngularJS:API:$ route
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.