What are the differences between Constructors and OnInit?
Constructors | OnInit |
---|---|
It is the default method used for constructing components. | It is an Angular 5 life cycle event method. |
It is a TypeScript feature which is used for class instantiations | It is used when there are any changes in the input or output binding values. |
It is called before the ngOnInit() | It is called after the constructors and the first ngOnChanges. |
BY Best Interview Question ON 13 May 2020