Skip to main content

Parent-child behavior, input changes and mistakes

Learn Parent-child behavior, input changes and mistakes (Module 9 · Component Lifecycle, Angular) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Parents and children together • A parent creates its children while rendering. The parent's constructor and ngOnInit run before the children are created; the children then run their hooks; and the parent's ngAfterViewInit runs only after all children finished theirs. Destruction goes parent first, then children. • When a parent changes a bound value, Angular updates the child input and calls the child's ngOnChanges . That is how input changes reach lifecycle hooks .

More lessons in Module 9 · Component Lifecycle