What is the difference between Constructor and ngOnInit in Angular?

0 votes
567 views
asked Jan 18, 2019 by Hitesh Garg (355 points)  

When we use the angular cli to generate a new component there is a hook for ngOnInit by default. Since we already have a constructor in the class why do we need this ngOnInit hook?

Please log in or register to answer this question.

...