Repository navigation
fix: element injector vs module injector - #15044
Conversation
ec67a6a to
9358917
Compare
There was a problem hiding this comment.
add tests
override provider in a child module
There was a problem hiding this comment.
test:
-
create a child module and bootstrap a cmp from it, should see child providers.
-
only pass a module if component factory has no
There was a problem hiding this comment.
ngModule should be public on ComponentFactory
There was a problem hiding this comment.
revert
add test: inject ViewContainerRef on a cmp TestBed.create(Comp).get()
There was a problem hiding this comment.
TestBed.get() -> injector
There was a problem hiding this comment.
check if we can pass the module instead
There was a problem hiding this comment.
injector -> ModuleRef only
There was a problem hiding this comment.
add simpler method & deprecate
outlet.activate(future, resolver, outletMap);
There was a problem hiding this comment.
add module can no longer shadow el
There was a problem hiding this comment.
Maybe Illegal sate: NgModule has to be provided?
There was a problem hiding this comment.
(as its an error that users never should run into)...
|
hi vicb, Thanks for your hard work. Do you have any idea when this will be merged into V4? Regards, |
|
@thaoula should be part of the next RC release |
fixes angular#12869 fixes angular#12889 fixes angular#13885 fixes angular#13870 Before this change there was a single injector tree. Now we have 2 injector trees, one for the modules and one for the components. This fixes lazy loading modules. See the design docs for details: https://docs.google.com/document/d/1OEUIwc-s69l1o97K0wBd_-Lth5BBxir1KuCRWklTlI4 BREAKING CHANGES `ComponentFactory.create()` takes an extra optional `NgModuleRef` parameter. No change should be required in user code as the correct module will be used when none is provided DEPRECATIONS The following methods were used internally and are no more required: - `RouterOutlet.locationFactoryResolver` - `RouterOutlet.locationInjector`
|
Hi Vicb, Awesome!!!. Do you know when that will be? Been waiting for a fix to this issue since November. Regards, |
| rootSelectorOrNode: string|any = null): ComponentRef<any> { | ||
| injector: Injector, projectableNodes?: any[][], rootSelectorOrNode?: string|any, | ||
| ngModule?: NgModuleRef<any>): ComponentRef<any> { | ||
| if (!ngModule) { |
There was a problem hiding this comment.
hi!
ngModule is defined as an optional variable, but here we see throw instruction.
Why?
After upgrading to 4.0.rc-4 we got an Exception below
ngModule should be provided
export declare abstract class ViewContainerRef {
abstract createComponent<C>(componentFactory: ComponentFactory<C>,
There was a problem hiding this comment.
This class implements the ComponentFactory<any> which requires this parameter be optional (https://github.com/angular/angular/blob/4.0.0-rc.4/packages/core/src/linker/component_factory.ts#L76-L78). However, this is an internal implementation that should never be called without a module so we check for internal consistency.
fixes angular#12869 fixes angular#12889 fixes angular#13885 fixes angular#13870 Before this change there was a single injector tree. Now we have 2 injector trees, one for the modules and one for the components. This fixes lazy loading modules. See the design docs for details: https://docs.google.com/document/d/1OEUIwc-s69l1o97K0wBd_-Lth5BBxir1KuCRWklTlI4 BREAKING CHANGES `ComponentFactory.create()` takes an extra optional `NgModuleRef` parameter. No change should be required in user code as the correct module will be used when none is provided DEPRECATIONS The following methods were used internally and are no more required: - `RouterOutlet.locationFactoryResolver` - `RouterOutlet.locationInjector`
fixes angular#12869 fixes angular#12889 fixes angular#13885 fixes angular#13870 Before this change there was a single injector tree. Now we have 2 injector trees, one for the modules and one for the components. This fixes lazy loading modules. See the design docs for details: https://docs.google.com/document/d/1OEUIwc-s69l1o97K0wBd_-Lth5BBxir1KuCRWklTlI4 BREAKING CHANGES `ComponentFactory.create()` takes an extra optional `NgModuleRef` parameter. No change should be required in user code as the correct module will be used when none is provided DEPRECATIONS The following methods were used internally and are no more required: - `RouterOutlet.locationFactoryResolver` - `RouterOutlet.locationInjector`
fixes angular#12869 fixes angular#12889 fixes angular#13885 fixes angular#13870 Before this change there was a single injector tree. Now we have 2 injector trees, one for the modules and one for the components. This fixes lazy loading modules. See the design docs for details: https://docs.google.com/document/d/1OEUIwc-s69l1o97K0wBd_-Lth5BBxir1KuCRWklTlI4 BREAKING CHANGES `ComponentFactory.create()` takes an extra optional `NgModuleRef` parameter. No change should be required in user code as the correct module will be used when none is provided DEPRECATIONS The following methods were used internally and are no more required: - `RouterOutlet.locationFactoryResolver` - `RouterOutlet.locationInjector`
|
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. |
TODO:
ViewContainerRef.parentInjector