I have a directive and on it is an @Input
that accepts a class.
@Directive({selector: 'my-directive'})
@View({directives: [CORE_DIRECTIVES]})
export class MyDirective {
@Input() inputSettings : SettingsClass;
@Input() count : number;
onChanges(map) {
console.log('onChanges');
}
}
The directive is used in html:
...
<my-directive [input-settings]="settings" [count]="settings.count"></my-directive>
...
If the settings.count is changed then the onChanges
will fire. If any other property on the settings class changes, then it will not fire.
How can I detect if there is a change to any property on settings?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…