How would one watch/trigger an event on a route change?
Note: This is a proper answer for a legacy version of AngularJS. See this question for updated versions.
$scope.$on('$routeChangeStart', function($event, next, current) { // ... you could trigger something here ... });
The following events are also available (their callback functions take different arguments):
See the $route docs.
There are two other undocumented events:
See What's the difference between $locationChangeSuccess and $locationChangeStart?
1.4m articles
1.4m replys
5 comments
57.0k users