angular / router

The Angular 1 Component Router
MIT License
665 stars 135 forks source link

Add global on state change #399

Open NetanelBasal opened 8 years ago

NetanelBasal commented 8 years ago

There is a way like in ui-router to add a global hook that's run on state change/success? This is very useful for example for Google analytics you need to do this:


$rootScope.$on('$stateChangeSuccess', function( event, toState, toParams, fromState, fromParams ) {
    ga('send', 'pageview', $location.path());
});