In Angular, every component has a lifecycle. Angular creates and renders these components and also destroys them before removing them from the DOM. This is achieved with the help of lifecycle hooks. Here's the list of them -
1. ngOnChanges() - Responds when Angular sets/resets data-bound input properties.
2. ngOnInit() - Initialize the directive/component after Angular first displays the data-bound properties and sets the directive/component's input properties/
3. ngDoCheck() - Detect and act upon changes that Angular can't or won't detect on its own.
4. ngAfterContentInit() - Responds after Angular projects external content into the component's view.
5. ngAfterContentChecked() - Respond after Angular checks the content projected into the component.
6. ngAfterViewInit() - Respond after Angular initializes the component's views and child views.
7. ngAfterViewChecked() - Respond after Angular checks the component's views and child views.
8. ngOnDestroy - Cleanup just before Angular destroys the directive/component.
Posted Date:- 2021-09-09 04:41:49
What Is Package.json? Explain its Purpose
What Is the Difference Between Class Decorators and Class Field Decorators?
What type of DOM does Angular implement?
What is Eager and Lazy loading?
What is Bootstrap? How is it embedded into Angular?
How Can You Disable All the Animations in Angular?
Is the Routing Module Mandatory for an Application?
Explain the Importance of HttpClient.
What Is the Purpose of an Async Pipe?
Which Is the Latest Version of Angular? What Are the New Features in It?
What are Promises and Observables in Angular?
What is the difference between AOT and JIT?
Explain the lifecycle hooks in Angular
What do you understand by scope in Angular?
What Is the Primary Language Used in Angular?
What is the difference between constructor and ngOnInit?
What are the differences between Angular decorator and annotation?
What do you mean by string interpolation?
What is view encapsulation in Angular?
What are filters in Angular? Name a few of them.
What is the PipeTransform interface?
What is the purpose of ngFor directive?
What is the option to choose between inline and external template file?
What is an AOT compilation? What are its advantages?
What are Annotations in Angular?
What are decorators in Angular?
What are Single Page Applications (SPA)?
What do you mean by data binding?
Could you explain services in Angular?
Describe the MVVM architecture.
Could we make an angular application to render on the server-side?
Define the ng-content Directive?
Why was Angular introduced as a client-side framework?
What are some advantages of using Angular?
What are the key components of Angular?
Why were client-side frameworks like Angular introduced?