Tengo un component which emit to propertyEvent if dialog res is true then app-general-details que tiene una salida y luego app-general-details son representados por el componente principal que es app-main-details y luego, en app-main-details tengo un evento que obtiene la salida de la app-general-details que es inspectionPropertyGeneralDetailsEvent(event:any) y luego, cada vez que se llama a este método, pasará una entrada a app-property-details y luego a la app-property-details detectará esos cambios.
Pero el problema es que ngOnchanges solo se activó y detectó una vez, aunque la entrada se actualizó. ¿Alguna idea chicos?
#app-archivo-acciones(ts)
@Output() propertyEvent = new EventEmitter<any>(); add() { const confirmDialog = this.dialog.open(AddPropertyDialogComponent, { autoFocus: false }); confirmDialog.afterClosed().subscribe((res) => { if (res) { this.propertyEvent.emit(res); } }); }#app-general-detalles (html)
<app-file-actions (propertyEvent)="propertyEvent($event)"></app-file-actions>#aplicación-general-detalles (ts)
@Output() inspectionPropertyGeneralDetailsEvent = new EventEmitter<any>(); propertyEvent(event:any){ this.inspectionPropertyGeneralDetailsEvent.emit(event); }#aplicación-principal-detalles(html)
<div> <app-general-details (inspectionPropertyGeneralDetailsEvent)="inspectionPropertyGeneralDetailsEvent($event)"></app-general-details> <app-property-details [hasChanges]="hasChanges"></app-property-details> </div>#aplicación-principal-detalles(ts)
inspectionPropertyGeneralDetailsEvent(event:any) { this.hasChanges= event; }#aplicación-propiedad-detalles (ts)
@Input() hasChanges: boolean; ngOnChanges(changes: SimpleChanges) { if(changes.hasChanges&& changes.hasChanges.currentValue) { console.log('here') this.getData(); }