Hi,

I am writing an AngularJS app and have a peculiar problem.

I have two states of the form /page/{pid}. They each have their own 
instance of the same controller (using controllerAs syntax), with the first 
line of the controller being pageCtrl=this. When I go straight from e.g. 
/page/1 to /page/2, pageCtrl seems to be overwritten. When I go back to 
/page/1 the pageCtrl object then seems to not be overwritten as the 
controller is not re-run, and now pageCtrl seems to be stale. This breaks 
the usual view <-> controller interactions.

While I can think of ways around this (e.g. using 'this' everywhere, and 
never 'pageCtrl'), it seems like an odd issue. I feel like I must have 
missed a best practice somewhere. Has anyone else observed it, and can 
anyone suggest a better way to avoid it without changing my coding 
practices for just one controller?

(Incidentally, I am using Ionic as well, but as far as I can tell the issue 
is due to the angular router)

Cheers,

Wrayal

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to