ACHARYA A K
Apr 24, 2023

--

Angular basic interview question What are the life cycle hooks in angular components? #angularMantra

cycle
  1. ngOnChanges — called before onInit if component have input / output and change happens
  2. ngOnInit — called once
  3. ngDoCheck — called every time change(event, click..etc) happens(change detection runs) alias as custom change detection
  4. ngAfterContentInit — called once after content initialise
  5. ngAfterContentChecked — called first time after ContentInit then successive ngDoCheck
  6. ngAfterViewInit — called once after first after content Checked and view initialised
  7. ngAfterViewChecked — called first time after View initialised post that successive content Checked
  8. ngAfterDestroy — called just before component destroy

--

--