Today I Learned

TIL, 2022-09-27, ngDoCheck

  • Really 5head: Reference as it looks like it’s disattaching itself from Angular to do the input changes and then manually calls change detection.
new Observable<KeyboardEvent>(subscriber =>
  this.ngZone.runOutsideAngular(() =>
    fromEvent<KeyboardEvent>(textarea.nativeElement, 'keydown').subscribe(subscriber)
  )
)
  • Lifecycle hooks to check Change Detection:
    • ngDoCheck(): Detect and act upon changes that Angular can’t or won’t detect on its own. See details and example in Defining custom change detection in this document. Called immediately after ngOnChanges() on every change detection run, and immediately after ngOnInit() on the first run.
  • vm$ will not retrigger on components who do not need the observable that changed, only if the component is ChangeDetection.onPush.

  • Directive modifying the HTML host. Reference

This project is maintained by daryllxd