What is the difference between ngoninit and ngafterviewinit?



What is the difference between ngoninit and ngafterviewinit?..

Answer / Hemant Pathak

ngOnInit is called after the component's inputs have been initialized, while ngAfterViewInit is called after Angular has finished rendering the initial view. ngAfterViewInit is useful for manipulating DOM elements that were created during the view initialization.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More AngularJS Interview Questions

What is ngfor in angular?

1 Answers  


What is pipe function?

1 Answers  


What is router and switch?

1 Answers  


What is angular controllers?

1 Answers  


Who invented angular?

1 Answers  


What is two-way bindings?

1 Answers  


What are the characteristics of 'scope'?

1 Answers  


How to create a service in angularjs?

1 Answers  


Should I use angular?

1 Answers  


Is google using angular?

1 Answers  


What are the difference between component and directive in angular 2?

1 Answers  


What is ngaftercontentinit?

1 Answers  


Categories