Lifecycle Methods - init,destroy
~20 mins
Task 1: Implement OnInit,OnDestroy
- Constructor will get called before OnInit
- OnInit, OnDestroy will get called only once.
export class AppComponent implements OnInit,OnDestroy{
constructor(){
console.log("Constructor")
}
ngOnInit(): void {
console.log("OnInit");
}
ngOnDestroy(): void {
console.log("OnDestroy");
}
}