Hi!
I'm new to AngularJS, and I try to implement directive which will remember
scroll position on a page. I use the function:
scope.$on('$stateChangeStart', function() { ... }
but it doesn't execute when I change the state (URL).
The whole logic looks like this:
function($window, $timeout, $location, $anchorScroll, $state) {
console.log("directive works")
return function(scope, element, attrs) {
console.log("function starts")
scope.$on('$stateChangeStart', function() {
console.log("state change start")
})
scope.$on('$stateChangeSuccess', function() {
console.log("state change finished")
})
}
}
In console I see: directive works, but I don't see either state change start
nor
state change finished.
How to execute the above methods?
--
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.