Computer Science, asked by waqar5257, 1 year ago

What is difference between ngoninit and constructor?

Answers

Answered by farwahalee14
0
The main difference between constructor and ngOnInit is thatngOnInit is lifecycle hook and runs after constructor. Component interpolated template and input initial values aren't available in constructor, but they are available in ngOnInit . The practical difference is how ngOnInit affects how the code isstructured.


Hope it helps.
Similar questions