我有以下......
ngDoCheck() {
let changes = this.differ.diff( this.immunization )
if ( changes ) {
changes.forEachChangedItem( r => {
/// previously worked API
console.log( r.currentValue.keys ) /// does not work
console.log( r.key ) /// does not work
console.log( 'changes detected' )
changes.forEachChangedItem( r => console.log( 'changed ', r.currentValue ) )
} )
// changes.forEachChangedItem( ( elt ) => {
// switch ( elt.key ) {
// case 'disease':
// console.log( 'Disease has changed' )
// }
//
// } )
}
}
我试图获取随ngDoCheck()更改的属性的键,但在上面的代码中没有太大成功。任何帮助表示赞赏
export class Immunization {
disease: string
}
immunization = new Immunization() // r logs immunization property change