Which lifecycle hook is called once when the component is initialized?

  • ngAfterViewInit
  • ngOnChanges
  • ngOnDestroy
  • ngOnInit
The ngOnInit lifecycle hook is called once when the component is initialized. It's a common place to put initialization logic for a component. ngOnChanges is called when input properties change, ngOnDestroy is called when the component is about to be destroyed, and ngAfterViewInit is called after the view has been initialized.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *