Currently, I am utilizing Bable for ES6 and webpack while working on an angular 1.x.x application. So far, I haven't encountered any issues. I am looking to implement a feature where I can keep track of all the Route Changes using UI-Router. However, I am facing a problem where the $stateChangeStart
event is not being triggered. Below is the code snippet:
/*All necessary includes are already taken care of. Please review the run method below*/
angular.module('chpApp', [
uirouter,
angular_animate,
uibootstrap,
formly,
formlyBootstrap,
ngMessages,
angularLoadingBar,
'ngNotificationsBar',
'jkuri.datepicker',
'LocalStorageModule',
'ncy-angular-breadcrumb',
'mgo-angular-wizard',
'luegg.directives',
'ngToast',
'ui.mask',
/*Application Modules*/
angularnvd3,
chpConstants,
menu,
header,
breadcrumb,
auth,
dashboard,
programs,
device
])
.run(['$rootScope', function($rootScope) {
$rootScope.$on('$stateChangeStart', () => {
console.log('lol')
})
}])
.config(routing);
I would appreciate any insights on what might be going wrong, as the state is indeed changing but the $stateChangeStart
event is not getting triggered. I have placed the run
method where I am connecting with the $stateChangeStart
listener.
My assumption is that it could be related to ES6, but I have been unable to find any relevant references so far. Thank you.