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

后端 未结 4 590
伪装坚强ぢ
伪装坚强ぢ 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:45

    Because that's how ui-router is designed.

    The controller is only loaded when it isn't in the same state. ui-router will not rerun a controller, and not reevaluate a view template. Even when you use the same controller on multiple states and switch between those, the controller will not rerun.

    If you want to run functionality when the a view changes you could listen for events, or even put an ng-click on your a element.

提交回复
热议问题