UI-Router state.go call back on state change

前端 未结 2 551
终归单人心
终归单人心 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:52

    $state.go() returns a promise.

    So do something like:

    $state.go('wherever', {whenever: 'whatever'}).then(function() {
      // Get in a spaceship and fly to Jupiter, or whatever your callback does.
    });
    

提交回复
热议问题