<div draggable (dragging)="copyDragging($event)">{{copyBoxDragging}}</div>
copyDragging(event) {
console.log('copyDragging :', event); // good
this.copyBoxDragging = event; // not reflected in html
}
@Output() dragging = new EventEmitter();
mousedrag$.subscribe(() => {
if (!this._dragging) {
this.dragging.emit(true);
this._dragging = true;
}
});
See the console.log
in parent.component.ts ? It is alway correctly prints the expected value. but assigning to a value in parent component (next line) does not reflect in parent html
is there something preventing me from assigning the emitted value in the parent component?
try to force change detection
constructor(private ref: ChangeDetectorRef) {
}
copyDragging(event) {
console.log('copyDragging :', event); // good
this.copyBoxDragging = event; // not reflected in html
this.ref.detectChanges();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.