Child custom element's OnInit hook is called before parent's one #28265
Labels
area: core
Issues related to the framework runtime
area: elements
Issues related to Angular Elements
core: lifecycle hooks
P3
An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
state: confirmed
Milestone
馃悶 bug report
Affected Package
The issue is caused by package @angular/elements
Is this a regression?
Dunno
Description
Wrong OnInit hooks call order when custom elements (parent + child) are added with some delay after (regular) angular component inited.
馃敩 Minimal Reproduction
https://stackblitz.com/edit/angular-elements-init-order?file=app%2Fapp.component.html
*ngIf="visible"
with*ngIf="true"
window.setTimeout
withinnerHTML
usage in AppComponent's OnInit hook<ng-container *ngIf="visible">
馃實 Your Environment
Angular Version:
7.1.4
Anything else relevant?
No such issue with native custom elements and
setTimeout
+innerHTML
usagehttps://stackblitz.com/edit/custom-elements-init-order?file=index.ts
Real word use-case: adding unknown markup with custom elements from api response.
The text was updated successfully, but these errors were encountered: