angular/packages/core/src
Andrew Kushnir 822439fddd fix(core): ViewContainerRef.createComponent should consult module injector when custom one is provided (#44966)
Before Ivy, it was only possible to call the `ViewContainerRef.createComponent` function with the ComponentFactory as the first argument. An instance of a `ComponentFactory` resolved via `ComponentFactoryResolver` contained a reference to an `NgModule` where the component is declared. As a result, the component maintained a DI connection with the module injector tree (by retrieving an instance of `NgModuleRef` internally), even when the custom injector was provided (we try to find a token in a custom injector first and consult module injector after that).

With Ivy, we expanded the `ViewContainerRef.createComponent` function API to support direct references to the Component classes without going through the factory resolution step. As a result, there was no connection to the NgModule that declares the component. Thus, if you provide a custom injector, this is the only injector that is taken into account.

This commit updates the logic for the factory-less case to try retrieving an instance of an `NgModuleRef` using the DI tree which `ViewContainerRef` belongs to. The `NgModuleRef` instance is then used to get a hold of a module injector tree. This brings the factory-less and factory-based logic to more consistent state.

Closes #44897.

PR Close #44966
2022-02-08 09:57:20 -08:00
..
change_detection fix(core): input coercion (#42803) 2022-02-07 10:52:59 -08:00
compiler feat(compiler-cli): initial implementation of standalone components (#44812) 2022-02-03 08:55:25 -08:00
debug refactor(core): cleanup DebugNode and DebugElement implementations (#44270) 2022-02-04 10:43:42 -08:00
di build: enable useUnknownInCatchVariables (#44679) 2022-02-01 18:17:29 +00:00
i18n build: update to cldr@39 (#43820) 2021-10-13 16:49:24 +00:00
interface ci: Upgrade tsec to 0.2.0. (#44205) 2021-11-24 18:55:58 +00:00
linker fix(core): ViewContainerRef.createComponent should consult module injector when custom one is provided (#44966) 2022-02-08 09:57:20 -08:00
metadata docs(core): showcase host listener support for specific keys in events (#44833) 2022-01-31 20:30:45 +00:00
reflection fix(core): input coercion (#42803) 2022-02-07 10:52:59 -08:00
render refactor: delete the View Engine runtime (#43884) 2021-11-23 21:10:06 +00:00
render3 perf(compiler): chain element start/end instructions (#44994) 2022-02-08 09:56:50 -08:00
sanitization refactor(core): make the error messages tree shakable (#44359) 2022-01-18 17:38:10 -08:00
testability docs: Remove references to protractor from documentation (#41731) 2021-05-03 14:26:09 -07:00
util fix(core): input coercion (#42803) 2022-02-07 10:52:59 -08:00
view refactor: delete the View Engine runtime (#43884) 2021-11-23 21:10:06 +00:00
zone fix(core): error if NgZone.isInAngularZone is called with a noop zone (#44800) 2022-01-24 10:44:43 -08:00
application_init.ts fix(core): input coercion (#42803) 2022-02-07 10:52:59 -08:00
application_module.ts refactor: delete the View Engine runtime (#43884) 2021-11-23 21:10:06 +00:00
application_ref.ts refactor(core): drop all .ngfactory and .ngsummary imports (#44957) 2022-02-07 15:31:49 -08:00
application_tokens.ts docs: clean up api doc in core (#37053) 2020-06-30 12:11:15 -07:00
change_detection.ts perf(core): remove support for the deprecated WrappedValue (#43507) 2021-10-01 12:25:19 -04:00
console.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
core.externs.js build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
core.ts refactor: delete the View Engine runtime (#43884) 2021-11-23 21:10:06 +00:00
core_private_export.ts fix(core): input coercion (#42803) 2022-02-07 10:52:59 -08:00
core_render3_private_export.ts refactor: delete the View Engine runtime (#43884) 2021-11-23 21:10:06 +00:00
di.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
error_details_base_url.ts refactor(core): move runtime error code logic (#44398) 2022-01-06 23:43:18 +00:00
error_handler.ts refactor(core): move runtime error code logic (#44398) 2022-01-06 23:43:18 +00:00
errors.ts refactor(core): the RuntimeError class should support more compact syntax (#44783) 2022-02-01 00:15:56 +00:00
event_emitter.ts refactor(core): ensure compatibility with noImplicitOverride (#42512) 2021-07-12 13:11:15 -07:00
linker.ts feat(core): add getNgModuleById function to retrieve loaded NgModules by id (#43580) 2021-10-04 16:35:26 -07:00
metadata.ts refactor(core): move injectAttributeImpl to avoid cycles (#37085) 2020-11-19 12:19:42 -08:00
platform_core_providers.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
r3_symbols.ts refactor(core): rename ɵɵInjectableDef interface to ɵɵInjectableDeclaration (#41316) 2021-04-07 13:57:12 -07:00
render.ts refactor(core): clean up circular dependencies (#39722) 2020-11-18 09:15:29 -08:00
version.ts Revert "refactor(core): optimize calls to split and slice while computing version parts (#41208)" 2021-05-12 14:13:50 -04:00
zone.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00