The ngOnInit method is a part of the ________ lifecycle hook in Angular.

  • Component
  • Directive
  • Module
  • Service
The ngOnInit method is a part of the "Component" lifecycle hook in Angular. This hook is called after Angular has initialized all data-bound properties but before rendering the view. Developers commonly use ngOnInit to perform initialization tasks for a component, such as fetching initial data or setting up subscriptions. Understanding Angular's lifecycle hooks is crucial for effective component development.
Add your answer
Loading...

Leave a comment

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