我想用 $rootScope.$broadcast() 里面 onExit 当状态改变时。
$rootScope.$broadcast()
onExit
但为此,我需要注射 $rootScope 在 .config() ,这在角度上是不可能的
$rootScope
.config()
onExit: function () { //onExit is executed when we leave that state and go to another $rootScope.$broadcast('broadCastCloseModalStr'); }
有人能帮我实现吗?
onExit: function($injector) { var rootScope = $injector.get('$rootScope'); console.log("onExit: ", rootScope); }
onExit: function($rootScope) { console.log("$rootScope: ", $rootScope) }
plunk