UI-Router state.go call back on state change

前端 未结 2 751
死守一世寂寞
死守一世寂寞 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 15:55

    $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.
    });
    

提交回复
热议问题