-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Dependency injection of custom service into another custom service #590
Comments
This is not an issue, you are not registering the service... Check out this: http://jsfiddle.net/vojtajina/4xu5g/ We want to make all the apis more consistent, I know, it's bit confusing now... Next time, ask on mailing list first: https://groups.google.com/forum/#!forum/angular |
Thank you for your advice, I have rewrited my code and it works now. I haven't read the documentation about the service registration very carefully... |
You have the injection annotation on the wrong object. function ServiceA(serviceB){} /// The short hand of the same thing 2011/10/13 lukaszdechovan <
|
I want to use dependency injection in my custom angular services.
I have one simple service A and another simple service B. When I inject these two to a controller, everything works as expected. However, when I try to use service A in service B and I want to inject A to the B service, nothing is injected (parameter where should be instance of Service B is undefined).
Is this a bug, angular doesn't support injection of custom service into another custom service by design, or I just made some mistake?
Here are the code snippets of my app:
File ServiceA.js
File SerivceB.js
File index.html
Thanks for your answers and advices.
The text was updated successfully, but these errors were encountered: