fix(ivy): support sub-class services that only inherit @Injectable
(#30388)
In View engine it is possible to instantiate a service that that has no `@Injectable` decorator as long as it satisfies one of: 1) It has no dependencies and so a constructor with no parameters. This is already supported in Ivy. 2) It has no constructor of its own and sub-classes a service which has dependencies but has its own `@Injectable` decorator. This second scenario was broken in Ivy. In Ivy, previous to this commit, if a class to be instantiated did not have its own `@Injectable` decorator and did not provide a constructor of its own, then it would be created using `new` with no arguments - i.e. falling back to the first scenario. After this commit Ivy correctly uses the `ngInjectableDef` inherited from the super-class to provide the `factory` for instantiating the sub-class. FW-1314 PR Close #30388
This commit is contained in:

committed by
Jason Aden

parent
35c1750fcc
commit
1a0e500eea
@ -122,6 +122,9 @@
|
||||
{
|
||||
"name": "getGlobal"
|
||||
},
|
||||
{
|
||||
"name": "getInheritedInjectableDef"
|
||||
},
|
||||
{
|
||||
"name": "getInjectableDef"
|
||||
},
|
||||
@ -131,6 +134,9 @@
|
||||
{
|
||||
"name": "getNullInjector"
|
||||
},
|
||||
{
|
||||
"name": "getUndecoratedInjectableFactory"
|
||||
},
|
||||
{
|
||||
"name": "hasDeps"
|
||||
},
|
||||
|
Reference in New Issue
Block a user