This is the documentation for Angular 6.
You can switch to the latest version Angular 7.

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.


Manual change detection run:

export class MyComponent {
  constructor(private cdr: ChangeDetectorRef) {

  runManual() {



When a view uses the OnPush (checkOnce) change detection strategy, explicitly marks the view as changed so that it can be checked again.

markForCheck(): void

Components are normally marked as dirty (in need of rerendering) when inputs have changed or events have fired in the view. Call this method to ensure that a component is checked even if these triggers have not occured.


Detaches this view from the change-detection tree. A detached view is not checked until it is reattached. Use in combination with detectChanges() to implement local change detection checks.

detach(): void

Detached views are not checked during change detection runs until they are re-attached, even if they are marked as dirty.


Checks this view and its children. Use in combination with detach to implement local change detection checks.

detectChanges(): void


Checks the change detector and its children, and throws if any changes are detected.

checkNoChanges(): void

Use in development mode to verify that running change detection doesn't introduce other changes.


Re-attaches the previously detached view to the change detection tree. Views are attached to the tree by default.

reattach(): void