1

Does it matter where we instantiate a $on listener with $routeOnChange? I currently have $rootScope.$on("$routeOnChange", myFunction) in two directives. In one directive the listener works fine when I refresh my website, but in the other directive, it only instantiates the directive but not triggered.

Lets call the directive that the listener triggers in, directiveA. In directiveA's html template, I use directiveB(doesn't trigger). I'm not sure if that would affect anything. It just seems weird that it would work/get triggered in one directive, but not the other. However, it does get triggered in directiveB if I go to a different page. Just refresh doesn't trigger it.

Thanks!

user6728767
  • 1,123
  • 3
  • 15
  • 31

0 Answers0