What is the purpose of the ngOnInit lifecycle hook in an Angular component?

  • To destroy the component
  • To handle HTTP requests and API calls
  • To initialize component properties
  • To subscribe to observables
The ngOnInit lifecycle hook is used to initialize component properties and perform any setup needed when a component is created.
Add your answer
Loading...

Leave a comment

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