OnChanges

Stable

Class

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. }

Class Overview

class OnChanges {
ngOnChanges(changes: SimpleChanges) : void

}

Class Description

Class Details

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