【发布时间】:2018-07-09 08:01:16
【问题描述】:
当状态改变时,我想在onExit 中使用$rootScope.$broadcast()。
但是为此,我需要在.config()中注入$rootScope,这在angular中是不可能的
onExit: function () {
//onExit is executed when we leave that state and go to another
$rootScope.$broadcast('broadCastCloseModalStr');
}
有人可以帮我实现吗?
【问题讨论】:
-
你能扩展你的问题并描述你是如何使用模态的吗?大多数模态都被解析为 Promise(在关闭它们时解析/拒绝)
-
@varun 你能添加更多代码并解释你想要做什么吗?
标签: angularjs angular-ui-router angularjs-scope rootscope