0

Is there a way to find out, from the injectee POV, who is the injector function?
For example, finding out from a factory function which controller injected you.

yairhaimo
  • 335
  • 2
  • 10
  • I think this other SO question is what you are looking for. http://stackoverflow.com/questions/21453697/angularjs-access-parent-scope-from-child-controller – Matthew Green Dec 30 '14 at 14:57
  • That question speaks about nested controllers and accessing parent scopes. I am looking for a way to find out which function injected "me". – yairhaimo Dec 30 '14 at 15:07
  • Which you could presumably do through accessing the parent scope which would be the function who did the injecting. – Matthew Green Dec 30 '14 at 15:09
  • The scope and scope hierarchy is not relevant in a factory/service. I am just looking for a way to find out who injected a specific service. Or did i not understand you correctly...? – yairhaimo Dec 31 '14 at 08:26
  • I haven't tried anything yet, which is why I haven't answered, but my thought was that if you could access the parent scope, in this case the calling controller, then you could look for values while in the factory as to who called it. – Matthew Green Dec 31 '14 at 14:14

0 Answers0