UI-Router state.go call back on state change

前端 未结 2 549
终归单人心
终归单人心 2021-02-11 15:29

I need a callback when state.go has been invoked successfully, and set my alert message. Currently the message is pushed to the array, after state.go has been called. State.go c

2条回答
  •  伪装坚强ぢ
    2021-02-11 15:43

    You may use state change listener.

     $rootScope
                .$on('$stateChangeSuccess',
                    function (event, toState, toParams, fromState, fromParams) {
                        //show alert()
                    });
    

    See State Change Events.

提交回复
热议问题