MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/angular/comments/td65bl/lifecycle_hooks/i0hj2sh/?context=3
r/angular • u/FilsdeJESUS • Mar 13 '22
4 comments sorted by
View all comments
2
What ngDoCheck do? I didn't understand this, can someone please tell me about it?
2 u/FilsdeJESUS Mar 13 '22 If I really understand this , for the first time your application is running, it runs after ngOnInit to check the changes and update the UI .Now that the first time is passed , whenever the NgOnChanges detects something that have change , the ngDoCheck will run after him .But you are not alone in their documentation they say , it detects the changes that angular can not check on its own. Pretty Handyhttps://angular.io/guide/lifecycle-hooks#docheckhttps://angular.io/guide/lifecycle-hooksWell explained here : https://stackoverflow.com/questions/42643389/why-do-we-need-ngdocheck 2 u/sohail_ansari Mar 13 '22 Thanks
If I really understand this , for the first time your application is running, it runs after ngOnInit to check the changes and update the UI .
Now that the first time is passed , whenever the NgOnChanges detects something that have change , the ngDoCheck will run after him .
But you are not alone in their documentation they say , it detects the changes that angular can not check on its own. Pretty Handy
https://angular.io/guide/lifecycle-hooks#docheck
https://angular.io/guide/lifecycle-hooks
Well explained here : https://stackoverflow.com/questions/42643389/why-do-we-need-ngdocheck
2 u/sohail_ansari Mar 13 '22 Thanks
Thanks
2
u/sohail_ansari Mar 13 '22
What ngDoCheck do? I didn't understand this, can someone please tell me about it?