OnChanges

Stable

Interface

What it does

Lifecycle hook that is called when any data-bound property of a directive changes.

How to use

.

  1. @Component({selector: 'my-cmp', template: `...`})
  2. class MyComponent implements OnChanges {
  3. @Input()
  4. prop: number;
  5. ngOnChanges(changes: SimpleChanges) {
  6. // changes.prop contains the old and the new value...
  7. }
  8. }

Interface Overview

interface OnChanges {
ngOnChanges(changes: SimpleChanges) : void

}

Interface Description

Interface Details

exported from core/index, defined in core/src/metadata/lifecycle_hooks.ts