UI-Router state.go call back on state change

前端 未结 2 744
死守一世寂寞
死守一世寂寞 2021-02-11 15:36

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 16:00

    You may use state change listener.

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

    See State Change Events.

提交回复
热议问题