Posted on 10th September 2024|80 views
By default, angular provides life cycle hook ngOnInit. Why should ngOnInit be used, if we already have a constructor?
Posted on 10th September 2024| views
A constructor is a method which is called whenever an object is created. It is generally used for initializing class members. In Angular, ngOnInit() is one of the component's life hooks called to indicate that component is initialized.