“ui-sref” does not refresh the “ui-view”(its controller does not rerun) when a link is clicked twice

后端 未结 4 585
伪装坚强ぢ
伪装坚强ぢ 2020-12-29 23:43

When a state is clicked at first, the div that owns the \"ui-view\" attribute is replaced with the \"template\" of that state. However, when I click the same state again, it

4条回答
  •  半阙折子戏
    2020-12-30 00:24

    Like Philipp said, it is because this is the default behavior of ui-router, BUT if you would like to reload your controller each time you click on your link, you can actually use the ui-sref-opts attribute to force it, like this:

    State 1
    

    Found this tip here:

    https://github.com/angular-ui/ui-router/commit/91a568454cc600aa4f34dedc8a80c9be1130b1c5

    Hope it could help

提交回复
热议问题