Hi everyone,
I use nbSpinner in parent-component:
.................
..................
(notify)="onChartNotify($event)">
In child-component.ts notify EventEmitter will return a boolean value:
...............
@Output()
notify: EventEmitter
.............................
private generateToolBox() {
return {
orient: 'vertical',
top: '5%',
feature: {
myTool1: {
show: true,
title: this.currentTranslations.Report,
icon: ChartConstants.PortraitIcon,
onclick: function () {
this.api.getDom().value.generateReport(false);
}
}
}
}
};
}
generateReport(isExtend: boolean): void {
this.notify.emit(true);
setTimeout(() => this.notify.emit(false), 3000);
}
In parent-component.ts, I handle event and set boolean value from child-component to isLoading:
.................
isLoading: boolean;
...................................
onChartNotify(message: boolean): void {
this.isLoading = message;
console.log(this.isLoading);
}
But when notify emit(false) that mean isLoading in parent-component assigned by false, nbSpinner still keep loading on parent page unless I click on the parent page
Please help me fix this problem !
Angular, Nebular
<!--
Check your `package-lock.json` or locate a `package.json` in the `node_modules` folder.
-->
this problem is the View will not update after variable change. I fixed:
Most helpful comment
this problem is the View will not update after variable change. I fixed:
import {ChangeDetectorRef} from '@angular/core'
constructor(private ref: ChangeDetectorRef){}
................
onChartNotify(message: boolean): void {
this.isLoading = message;
this.ref.detectChanges();
}