1.

What is ngOnInit?

Answer»

ngOnInit is a lifecycle hook and callback function used by Angular to mark the creation of a component. It accepts no arguments and returns a void type.

Example: 

export class MyComponent implements OnInit {
constructor() { }
   ngOnInit(): void {
       //....
   }
}


Discussion

No Comment Found