Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Service is injectable without Injectable decorator #12098
I'm submitting a ... (check one with "x")
The documentation of Injectable says:
The CLI also adds Injectable to all the services it creates, and the tutorial explains that a service must have this annotation.
However, a simple experiment with a component using a service not annotated with Injectable works fine (see http://plnkr.co/edit/IJVf79C1D8bNVLg9Kh2f?p=preview for example). It seems that the Injectable annotation is actually only needed if the service itself has dependencies that must be injected in its constructor, but that doesn't match with what the documentation says.
angular should throw an error when an injector is trying to create an instance of a service not decorated with Injectable. Or the documentation should be fixed to explain what Injectable really is for.
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
Please tell us about your environment: