I want to use $rootScope.$broadcast() inside onExit when state changes.
But for this, I need to inject $rootScope in the .config(), which is not possible in angular
onExit: function () {
//onExit is executed when we leave that state and go to another
$rootScope.$broadcast('broadCastCloseModalStr');
}
Can someone help me to achieve it?
Use the
$injectorto inject the$rootScopeinto the onExit, like soHowever, this should also work
Here is a working plunk