Deliver web apps with confidence 🚀
Find a file
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
.circleci ci: re-enable components repo unit tests job (#44832) 2022-01-27 09:22:23 -08:00
.devcontainer ci: update default circle ci image to cimg/node:14.17.6 (#43810) 2021-10-12 17:43:15 +00:00
.github build: update angular (#44981) 2022-02-07 09:21:09 -08:00
.husky build: remove unnecessary husky gitignore file (#42870) 2021-07-19 17:31:55 -07:00
.ng-dev build: exclude devtools scope from generated changelogs (#44964) 2022-02-03 15:19:25 -08:00
.vscode docs: added commas to sentences in .vscode/README.md (#43684) 2021-10-21 18:39:58 +00:00
.yarn build: update to yarn v1.22.17 (#44150) 2021-11-15 11:19:05 -08:00
aio docs: fix command to clear cache on Windows (#44988) 2022-02-07 21:18:03 -08:00
devtools fix(devtools): change links to the angular repo (#44885) 2022-02-02 15:33:17 -08:00
docs docs(common): url link format updated (#44645) 2022-01-06 23:49:47 +00:00
goldens refactor(forms): update PatternValidator to inherit AbstractValidatorDirective (#44887) 2022-02-07 12:07:34 -08:00
integration refactor(core): drop all .ngfactory and .ngsummary imports (#44957) 2022-02-07 15:31:49 -08:00
modules refactor(core): drop all .ngfactory and .ngsummary imports (#44957) 2022-02-07 15:31:49 -08:00
packages fix(core): ViewContainerRef.createComponent should consult module injector when custom one is provided (#44966) 2022-02-08 09:57:20 -08:00
scripts ci: only build test targets for components repo unit test job (#44832) 2022-01-27 09:22:23 -08:00
third_party build: rename shims_for_IE.js -> shims_for_internal_tests.js (#43002) 2021-08-02 10:38:42 -07:00
tools refactor(dev-infra): convert nullish coalescing operator to plain javascript (#44968) 2022-02-04 10:40:43 -08:00
.bazelignore refactor(devtools): bring the angular devtools directory into the root bazel workspace 2022-01-26 16:35:31 -05:00
.bazelrc refactor: setup bazel integration test with new integration rule (#44238) 2021-12-08 13:42:41 -05:00
.bazelversion build: update .bazelversion (#44641) 2022-01-06 23:49:02 +00:00
.clang-format feat(tooling): Add a .clang-format for automated JavaScript formatting. 2015-04-02 08:44:34 -07:00
.editorconfig build: use https link to editorconfig.org in .editorconfig (#27664) 2018-12-18 09:30:09 -08:00
.gitattributes build: remove ts-api-guardian from repository (#42735) 2021-07-26 12:02:14 -07:00
.gitignore build: Turn tsec checks into bazel tests. (#43108) 2021-09-13 14:45:57 -07:00
.gitmessage docs: update devtools docs, and add to the list of available commit scope list (#44863) 2022-02-01 21:28:09 +00:00
.mailmap build: add a Git .mailmap with my new name (#19550) 2017-10-09 14:35:30 -07:00
.npmrc build: rely on engines to prevent using npm for dependency install (#41477) 2021-04-07 12:05:01 -07:00
.nvmrc build: update repository to node@16 locally (#44211) 2021-11-24 18:55:33 +00:00
.prettierrc ci: use prettier to format yml files (#42136) 2021-05-19 11:20:20 -07:00
.pullapprove.yml build: update pullapprove (#44962) 2022-02-03 12:39:38 -08:00
.yarnrc build: update to yarn v1.22.17 (#44150) 2021-11-15 11:19:05 -08:00
browser-providers.conf.js ci: attempt to increase stability of saucelabs legacy job (#44281) 2021-11-30 11:56:04 -05:00
BUILD.bazel build: rename shims_for_IE.js -> shims_for_internal_tests.js (#43002) 2021-08-02 10:38:42 -07:00
CHANGELOG.md docs: release notes for the v13.2.2 release (#45019) 2022-02-08 09:51:54 -08:00
CODE_OF_CONDUCT.md docs: add Discord as an official communication channel (#39149) 2020-10-14 10:23:15 -07:00
CONTRIBUTING.md docs: update devtools docs, and add to the list of available commit scope list (#44863) 2022-02-01 21:28:09 +00:00
gulpfile.js build: convert CLDR locale extraction from Gulp to Bazel tool (#42230) 2021-07-16 12:44:59 -07:00
karma-js.conf.js build: bundle spec files for saucelabs legacy job (#44281) 2021-11-30 11:56:04 -05:00
LICENSE build: bump license year (#44590) 2022-01-04 12:05:25 -08:00
package.json release: cut the v14.0.0-next.2 release (#45008) 2022-02-07 17:19:17 -08:00
README.md docs: fixed meetup URL (#44585) 2022-01-04 12:05:45 -08:00
renovate.json ci: group all scorecard action dependencies (#44998) 2022-02-07 09:46:29 -08:00
test-events.js build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
tsconfig-tslint.json refactor(devtools): run ng-dev format on angular devtools files 2022-01-26 16:35:30 -05:00
tslint.json refactor(devtools): bring the angular devtools directory into the root bazel workspace 2022-01-26 16:35:31 -05:00
WORKSPACE build: update all non-major dependencies (#44855) 2022-01-31 21:30:10 +00:00
yarn.lock build: update dependency @types/chrome to ^0.0.178 (#44982) 2022-02-07 12:08:28 -08:00
yarn.lock.readme.md build: remove travisci leftovers (#27979) 2019-01-09 10:41:16 -08:00

Angular - The modern web developer's platform.

angular-logo
Angular is a development platform for building mobile and desktop web applications
using Typescript/JavaScript and other languages.

www.angular.io

Contributing Guidelines · Submit an Issue · Blog

CI status   Angular on npm   Discord conversation


Documentation

Get started with Angular, learn the fundamentals and explore advanced topics on our documentation website.

Advanced

Development Setup

Prerequisites

Setting Up a Project

Install the Angular CLI globally:

npm install -g @angular/cli

Create workspace:

ng new [PROJECT NAME]

Run the application:

cd [PROJECT NAME]
ng serve

Angular is cross-platform, fast, scalable, has incredible tooling, and is loved by millions.

Quickstart

Get started in 5 minutes.

Ecosystem

angular ecosystem logos

Changelog

Learn about the latest improvements.

Upgrading

Check out our upgrade guide to find out the best way to upgrade your project.

Contributing

Contributing Guidelines

Read through our contributing guidelines to learn about our submission process, coding rules and more.

Want to Help?

Want to report a bug, contribute some code, or improve documentation? Excellent! Read up on our guidelines for contributing and then check out one of our issues labeled as help wanted or good first issue.

Code of Conduct

Help us keep Angular open and inclusive. Please read and follow our Code of Conduct.

Community

Join the conversation and help the community.

Love Angular badge

Love Angular? Give our repo a star ⬆️.