Reputation: 16629
I'm currently using directives
in my ionic
app, there directives are normally bind to a angular controller
. So my problem is, when I navigate through the app, my controllers are not loading (loads for the first time) and hence I cannot setup some initial values.
Following is an example
users
screen/pageusers controller
loads (When I check with Chrome dev tools)users
screenAt this point I expect users controller
to load again, to setup my initial values, but it's not happening
I'm not sure if this is the default behavior, or am I missing something?
Upvotes: 0
Views: 31
Reputation: 5435
if you are using nested states, parent.child1, parent.child2, parent only loads 1 for the entire hierarchy, changing from child1 to child 2 will not reload the parent controller, thats one of the pros of using ui-router.
also note that with ionic latest version they introduced view caching so, the controller is only instanciated once for each view, to prevent that you need to use
cache-view="false"
in your ion-view
http://ionicframework.com/docs/api/directive/ionNavView/
Upvotes: 1