test(ivy): remove ngComponentOutlet example with a lazy-loaded NgModule #29094
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR removes one of the existing examples and the associated e2e test. This might sound like a terrible thing to do (why would one remove an example from documentation???) but I will argue that this example does more harm than good.
There are multiple levels of problems with the code being demonstrated and the test setup, let me explain it step by step:
ngComponentOutlet
- this directive takes componentType
andNgModuleFactory
as@Input()
s. Normally theType
should be enough but in view engine it is not enough for lazy loaded modules. SoNgModuleFactory
was introduced to support components from lazy-loaded modules but this is wrong API -componentFactoryResolver
should have been used instead as it would cover both regular and lazy-loaded modules;Type
was used instead ofcomponentFactoryResolver
since dealing withcomponentFactoryResolver
is less ergonomic as compared to simply usingType
. But this limitation will go away in ivy so introducingcomponentFactoryResolver
intongComponentOutlet
at this point would just confuse everyone;NgModuleFactory
before ivy is default but getting an instance ofNgModuleFactory
in practice is super-difficult for an end-user - one either need to lazy-load it or use aCompiler
(as in the example being deleted). I don't think that we want to teach people usage ofCompiler
for lazy loaded modules so this is why I'm claiming that the current example does more harm than good (teachesCompiler
instead of lazy loading).With ivy all those workflows (lazy loading, dynamic component instantiation) will get dramatically simpler so there is no great value in building examples on broken APIs and overly complex workflows.
As such I'm proposing the following:
ngComponentOutletNgModuleFactory !: NgModuleFactory<any>;
input