adspace
Explain the difference between constructor and ngoninit in angular 6?
Answer Posted / Meghna Singh
In Angular, the Constructor is a method that is called when an instance of a component or service is created. It is used to initialize properties and set up dependencies. The `ngOnInit` lifecycle hook, on the other hand, is called after the component's properties have been initialized and is used to perform any additional setup or initialization that requires data from services or other sources.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Angularjs dependency injection of value inside of the module.config?
How an object or function can get a hold of its dependencies?
How to implement a datagrid table with angular 2 and primeng?
What is the latest version of angular?
Give the example of angularjs strings?
How can primeng be used with angular2?
How to use primeng in angular 4?
How to enable html5 mode in angular 1.x?
What is a dynamic route in angularjs and how do you implement it?
What is the latest angular?
Which version you are using js?
How to get and log an error in angular 4?
How to create angularjs filter which outputs html?