2
我想在$location
更改前运行一个转换,在香草JS中,我可以选择不处理onhashchange
或pushstate
更新,直到我准备好了,但是如何在AngularJS中实现此目标?
我想在$location
更改前运行一个转换,在香草JS中,我可以选择不处理onhashchange
或pushstate
更新,直到我准备好了,但是如何在AngularJS中实现此目标?
看看$ locationChangeStart(还有很多其他的活动,你可能想看看还有:$ locationChangeSuccess,$ includeContentLoaded,$ viewContentLoaded,$ routeChangeStart,$ routeChangeError,$路由更新,$ routeChangeSuccess
$scope.$on("$locationChangeStart", function (event, nextLocation, currentLocation) {
// Do things here and then you can use event.preventDefault()
});
谢谢,我会试试看。此外,我想我会通过调用'$ routes.reload()'重新启动进程。 –