Stable Class
Lifecycle hook that is called when any data-bound property of a directive changes.
.
@Component({selector: 'my-cmp', template: `...`})
class MyComponent implements OnChanges {
@Input()
prop: number;
ngOnChanges(changes: SimpleChanges) {
// changes.prop contains the old and the new value...
}
}
class OnChanges {
ngOnChanges(changes: SimpleChanges) : void
}
ngOnChanges is called right after the data-bound properties have been checked and before view and content children are checked if at least one of them has changed. The changes parameter contains the changed properties.
ngOnChanges(changes: SimpleChanges) : void
exported from @angular/core/index, defined in @angular/core/src/metadata/lifecycle_hooks.ts
© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v2.angular.io/docs/ts/latest/api/core/index/OnChanges-class.html