https://angular.io/guide/lifecycle-hooks#sequence-and-frequency-of-all-lifecycle-events
Going through the examples in the official docs right now.
Having trouble understanding the sequence of the lifecycle methods.
**code: **https://stackblitz.com/run?file=src%2Fapp%2Fpeek-a-boo-parent.component.ts
- There is a parent and a child component.
-The parent component is communicating a variable called "name" to the child component using the@Inputdirective
-When the name is updated in the parent component. (By clicking the "Update Hero" button, The lifecycle methods in the child component are run in the following order (the official code uses a logger to find this out):
DoCheck()
AfterContentChecked()
AfterViewChecked()
OnChanges(): name changed to "Windstorm!"
DoCheck()
AfterContentChecked()
AfterViewChecked()
I would have expected:
OnChanges(): name changed to "Windstorm!"
DoCheck()
AfterContentChecked()
AfterViewChecked()
I do not understand why before onChanges() runs, the other 3 methods run too.