Reputation: 9074
After updating from 8.1 to 8.2 I get many errors like this
MyComponent.html:6 ERROR TypeError: Cannot read property 'ngInjectableDef' of undefined
at getInjectableDef (core.js:361)
at resolveNgModuleDep (core.js:30377)
at NgModuleRef_.get (core.js:31578)
at injectInjectorOnly (core.js:734)
at ɵɵinject (core.js:744)
at injectArgs (core.js:837)
at core.js:16346
at _callFactory (core.js:30486)
at _createProviderInstance (core.js:30429)
at resolveNgModuleDep (core.js:30388)```
Upvotes: 0
Views: 1099
Reputation: 9074
I found one reason...
I had many places like this
export class AbstractSth {
constructor(protected service: SomeService) {}
}
export class SpecialSth extends AbstractSth {
// ... special stuff (no constructor needed in 8.1)
}
Well it turned out that with 8.2 the SpecialSth class needs its own constructor with a super() call, because somehow now only the child class gets the needed properties injected and with no constructor nothing is injected and the inherited parent constructor seems to be ignored in the injection logic.
So this fixes the problem:
export class SpecialSth extends AbstractSth {
constructor(protected service: SomeService) {
super(service);
}
// ... special stuff
}
Upvotes: 2