State onEnter

91 views
Skip to first unread message

mark goldin

unread,
Sep 22, 2014, 5:21:22 PM9/22/14
to ang...@googlegroups.com
I have defined my state like this:
.state('one', {
      templateUrl: 'app/views/page1.html',
      controller: 'controller1',
      onEnter: ['$rootScope', 'currentUser', function ($rootScope, currentUser) {
   $rootScope.$emit('loggedIn', currentUser);
 }]
      })

but when page1 is loaded onEnter listener is not fired. Any idea?

Thanks

Stephen Friedrich

unread,
Sep 23, 2014, 9:50:58 AM9/23/14
to ang...@googlegroups.com
Works for me.
Which version of angular and angular-ui?
No errors in the browser's console?
Can you build an example in a plunkr?

mark goldin

unread,
Sep 23, 2014, 10:33:13 AM9/23/14
to ang...@googlegroups.com

--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/W4A_JkDT2_g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Stephen Friedrich

unread,
Sep 23, 2014, 11:40:19 AM9/23/14
to ang...@googlegroups.com
Nothing particularly specific, but
* Why do you need angular-route, if you also include angular-ui-router? (Maybe that works, or even makes sense - I just always thought of angular-ui-router as a complete replacement for ngRoute.)
* Why still 1.2.0? The 1.2 branch is at the 25th bug fix release! There have been a couple of breaking changes though, so be careful: https://github.com/angular/angular.js/blob/master/CHANGELOG.md
* angular-ui-router is also a couple of bug fix releases ahead

To really help you an example in plunkr (or somewhere else) would be helpful.



Reply all
Reply to author
Forward
0 new messages