What is difference between ngoninit and constructor?
Answers
Answered by
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.
Hope it helps.
Similar questions