angularjs controller instantiation, ui-router

こ雲淡風輕ζ 提交于 2019-12-08 23:13:37

The view's controller for a particular state runs when you go from state outside of the hierarchy tree of that state to that state or one of its descendants.

In other words, if, say, you have the following hierarchy:

     A     B
    /     /
   AA    C
        / \
       C1 C2

Then, switching from A to B would instantiate B. Switching then to C (or C1 or C2, for that matter), and then back to B, would not re-instantiate B's controller.

If you switch to A (or AA), then A would instantiate. Then switching back to B would re-instantiate B.

So, most likely in your case, C is a child state of B. And A and B are in separate ancestry trees.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!