What is the difference between Constructor and ngOnInit in Angular?

0 votes
asked Jan 18, 2019 by Hitesh Garg (799 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.