When building an Angular app, there will be times when we need to execute some code at some specific event—such as when a component is initialized or displayed on the screen or when the component is being removed from the screen. This is what lifecycle hooks are used for. For example, if we have some event listener attached to an HTML element in a component, such as a button click or form submission, we can remove that event listener before removing the component from the screen, just like we can fetch some data and display it on the screen in a component after the component is loaded on the screen. To use a lifecycle hook, we can override some methods on a component, such as ngOnInit or ngAfterViewInit. These methods, if available on a component, will be called by Angular automatically. This is why these are called lifecycle hooks.
Posted Date:- 2021-09-09 05:05:22
Please explain the digest cycle in Angular?
Could you explain the difference between Angular expressions and JavaScript expressions?
Could you explain the concept of templates in Angular?
What should replace the “?�
How can you read full response?
What are HttpInterceptors in Angular?
What is server-side rendering in Angular?
What are the differences between Angular expressions and JavaScript expressions?
What are the differences between AngularJS and Angular?
What is the purpose of the common module in Angular?
What is multicasting in Angular?
What is the digest cycle process in Angular?
Describe Angular authentication and authorization.
Can I use any javascript feature for expression syntax in AOT?
What is the purpose of metadata json files?
What is HttpClient and its benefits?
How do you perform Error handling?
What does Angular Material mean?
What is the difference between pure and impure pipe?
Write a Sample Code to Create a Library
What Do You Know About the NPM Package?
What Is an Angular Library? Can You Create Your Own Library in Angular?
List the Differences Between Just-In-Time (JIT) Compilation and Ahead-Of-Time (AOT) Compilation
What Are the Different Types of Compilations in Angular?
What Is the Single Page Application? How Is It Different From Traditional Web Technology?
What Is a Bootstrapping Module in Angular?
Please explain the difference between Angular and AngularJS?
How do Observables differ from Promises?
How to generate a class in Angular 7 using CLI?
What Does {{}} Represent? What Is It Used For? Show an Example
Can you explain the concept of scope hierarchy in Angular?
Explain Angular Authentication and Authorization.
What is string interpolation in Angular?
Enumerate some salient features of Angular 7.
How do you categorize data binding types?
What are template expressions?
What happens if you use script tag inside template?
What is a two-way data binding?
What are lifecycle hooks in Angular?
What is the option to choose between inline and external template file?