During our time working with AngularJS
, we utilized the $routeChangeStart/End
event in the $rootScope
to monitor changes in the route object. What is the equivalent method for monitoring route changes in Angular2?
How can we achieve the same functionality as the code snippet below in Angular2?
$scope.$on('$routeChangeStart', function (scope, next, current) {
//do what you want
});
I came across some discussions on this topic but didn't find detailed information, prompting me to ask a new question.
angular2 $routeChangeStart , $routeChangeSuccess ,$routeChangeError