Repository navigation
Conversation
|
You can preview 14b38f8 at https://pr25092-14b38f8.ngbuilds.io/. |
mhevery
left a comment
There was a problem hiding this comment.
I think this is the right approach.
There was a problem hiding this comment.
nit: Injector_ => NodeInjector
There was a problem hiding this comment.
I think this should not have been public. I think we should add @deprecate to this. My understanding is that because we have @SkipSelf it is at times necessary to get a hold of parent injector. Injector interfaces does not have a pointer to parent, hence we have this API. Also the Injectors for nodes are created lazily so I think this is the reason to be able to get parent.
I think this is an internal only think hence it should be deprecated.
There was a problem hiding this comment.
I've only added the @deprecated flag on parentInjector, not sure if it is enough for now.
In the framework, we use it only in ViewContainerRef.createComponent() and on the NgComponentOutlet directive. I've tried to replace it with ``ViewContainerRef.injector` and all the tests are passing.
14b38f8 to
d073c9c
Compare
d073c9c to
5c6eff6
Compare
|
You can preview 5c6eff6 at https://pr25092-5c6eff6.ngbuilds.io/. |
5c6eff6 to
b324fbe
Compare
|
You can preview b324fbe at https://pr25092-b324fbe.ngbuilds.io/. |
BREAKING CHANGE: ViewContainerRef.parentInjector is deprecated without replacement
|
You can preview 93627ea at https://pr25092-93627ea.ngbuilds.io/. |
| /** @deprecated No replacement */ | ||
| get parentInjector(): Injector { | ||
| const parentLInjector = getParentLNode(this._hostNode).nodeInjector; | ||
| return parentLInjector ? new NodeInjector(parentLInjector) : new NullInjector(); |
There was a problem hiding this comment.
change new NullInjector() for Injector.NULL ?
|
rebased in #25174 |
|
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. |
This PR implements the getters of ViewContainerRef: element and injector.
As per @mhevery comment, parentInjector is deprecated.