Revision e9bff5fe9f40d87b2164fc4f667f2cdd0afd4634 authored by George Kalpakas on 05 June 2020, 17:14:18 UTC, committed by atscott on 05 June 2020, 17:36:39 UTC
Previously, event listeners for component output events attached on an Angular custom element before inserting it into the DOM (i.e. before instantiating the underlying component) didn't fire for events emitted during initialization lifecycle hooks, such as `ngAfterContentInit`, `ngAfterViewInit`, `ngOnChanges` (initial call) and `ngOnInit`. The reason was that that `NgElementImpl` [subscribed to events][1] _after_ calling [ngElementStrategy#connect()][2], which is where the [initial change detection][3] takes place (running the initialization lifecycle hooks). This commit fixes this by: 1. Ensuring `ComponentNgElementStrategy#events` is defined and available for subscribing to, even before instantiating the component. 2. Ensuring `NgElementImpl` subscribes to `NgElementStrategy#events` before calling `NgElementStrategy#connect()` (which initializes the component instance). Jira issue: [FW-2010](https://angular-team.atlassian.net/browse/FW-2010) [1]: https://github.com/angular/angular/blob/c0143cb2abdd172de1b95fd1d2c4cfc738640e28/packages/elements/src/create-custom-element.ts#L167-L170 [2]: https://github.com/angular/angular/blob/c0143cb2abdd172de1b95fd1d2c4cfc738640e28/packages/elements/src/create-custom-element.ts#L164 [3]: https://github.com/angular/angular/blob/c0143cb2abdd172de1b95fd1d2c4cfc738640e28/packages/elements/src/component-factory-strategy.ts#L158 Fixes #36141 PR Close #36161
1 parent 411cb0c
File | Mode | Size |
---|---|---|
.circleci | ||
.devcontainer | ||
.github | ||
.ng-dev | ||
.vscode | ||
.yarn | ||
aio | ||
dev-infra | ||
docs | ||
goldens | ||
integration | ||
modules | ||
packages | ||
scripts | ||
third_party | ||
tools | ||
.bazelignore | -rw-r--r-- | 4.3 KB |
.bazelrc | -rw-r--r-- | 6.5 KB |
.bazelversion | -rw-r--r-- | 213 bytes |
.clang-format | -rw-r--r-- | 73 bytes |
.editorconfig | -rw-r--r-- | 245 bytes |
.gitattributes | -rw-r--r-- | 314 bytes |
.gitignore | -rw-r--r-- | 655 bytes |
.mailmap | -rw-r--r-- | 51 bytes |
.nvmrc | -rw-r--r-- | 8 bytes |
.pullapprove.yml | -rw-r--r-- | 35.8 KB |
.yarnrc | -rw-r--r-- | 128 bytes |
BUILD.bazel | -rw-r--r-- | 1.6 KB |
CHANGELOG.md | -rw-r--r-- | 704.7 KB |
CODE_OF_CONDUCT.md | -rw-r--r-- | 1.1 KB |
CONTRIBUTING.md | -rw-r--r-- | 13.5 KB |
LICENSE | -rw-r--r-- | 1.1 KB |
README.md | -rw-r--r-- | 1.2 KB |
WORKSPACE | -rw-r--r-- | 4.3 KB |
browser-providers.conf.js | -rw-r--r-- | 8.9 KB |
gulpfile.js | -rw-r--r-- | 1.2 KB |
karma-js.conf.js | -rw-r--r-- | 7.6 KB |
package.json | -rw-r--r-- | 8.1 KB |
shims_for_IE.js | -rw-r--r-- | 117.0 KB |
test-events.js | -rw-r--r-- | 259 bytes |
test-main.js | -rw-r--r-- | 11.3 KB |
tslint.json | -rw-r--r-- | 2.3 KB |
yarn.lock | -rw-r--r-- | 624.4 KB |
yarn.lock.readme.md | -rw-r--r-- | 1.3 KB |
Computing file changes ...