Answers for "onchanges vs docheck"

1

onchanges vs docheck

Comparison
- ngOnChanges() (OnChanges) is called when a value bound to an input has changed so you can run custom code when an input has changed.
- ngDoCheck() (DoCheck) is called when change detection runs so you can implement your custom change detection action.

Change detection can run for reasons other than inputs being changes. 
Reasons such as native events, XHR, etc...
Posted by: Guest on April-26-2021

Browse Popular Code Answers by Language