Repository navigation
[4.x only] feat(compiler): should only inject services annotated with @Injectable - #14931
DzmitryShylovich wants to merge 1 commit into
Conversation
BREAKING CHANGE: Before this commit it was not nessesary to add @Injectable when a service had contructor without args or if any other decorator was applied. After this commit @Injectable is mandatory for all services provided using useClass. Before: class SomeService {} @component({selector: 'my-app', template: ''}) class AppComponent { constructor(service: SomeService) {} } After: @Injectable() class SomeService {} @component({selector: 'my-app', template: ''}) class AppComponent { constructor(service: SomeService) {} } Closes angular#12467 Closes angular#13820
|
it can make a huge impact on existing apps. I think it needs deprecation phase and warning message. |
|
@laco0416 I agree it will have a huge impact but what exactly is it deprecating? and it does have a warning message: |
|
I expect it emits only warning messages without any effects on application behaviors. |
|
@laco0416
don't think so. it's already recommended in the style guide to always use |
|
First, the style guide says only "Use https://angular.io/docs/ts/latest/guide/style-guide.html#!#07-04
And as you say, the recommendation is existing at https://angular.io/docs/ts/latest/guide/dependency-injection.html#!#injectable . but this is just a suggestion. not a warning. Angular hasn't warned Injectable-less services anywhere yet. It's not ready to be broken. |
|
Only security fixes go to 4.x |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Closes #12467
Closes #13820