ngOnInit is a lifecycle hook and a callback method that is run by Angular to indicate that a component has been created. It takes no parameters and returns a void type.
export class MyComponent implements OnInit {
constructor() { }
ngOnInit(): void {
//….
}
}
Leave a Reply