Reputation: 1629
I have multiple nested views ui-view on my page with corresponding states to set templates in those views. When I transition to a child state, controller associated to each of its parent states gets called. I want to prevent this.
For example, if I transition to state root.question.mcq.menu
, the controller associated with state root.question.mcq
too gets called.
How can I prevent this so that only the controller associated with root.question.mcq.menu
gets called.
Upvotes: 6
Views: 1037
Reputation: 3104
It depends where you come from. Do you come from the parent or from a sibling of the target state the parent controller should not be initialized. But if you come from any other state the parent controller will be initialized. If this behavior is wrong for you then you probably have a design issue.
Upvotes: 1