ChangeDetectorRef
This is the documentation for Angular 6.
You can switch to the latest version Angular 10.
You can switch to the latest version Angular 10.
Base class for Angular Views, provides change detection functionality.
A change-detection tree collects all views that are to be checked for changes.
Use the methods to add and remove views from the tree, initiate change-detection,
and explicitly mark views as _dirty_
, meaning that they have changed and need to be rerendered.
Example
Manual change detection run:
export class MyComponent {
constructor(private cdr: ChangeDetectorRef) {
}
runManual() {
this.cdr.detectChanges();
}
}
Methods
markForCheck()
#
markForCheck(): void
detach()
#
detach(): void
detectChanges()
#
detectChanges(): void
checkNoChanges()
#
checkNoChanges(): void
reattach()
#
reattach(): void