0 votes
in Angular by
What is ngOnInit in angular?

1 Answer

0 votes
by

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 {
        //....
    }
}
...