Reputation: 1092
I'm trying to create a progressbar dialog with ngx bootstrap using its modals. I currently have the following:
generateDownload(distance: DistanceSplit) {
this.dialogWait = this.dialogs.wait('Wait');
list.forEach((distance, index) => {
// ...
this.dialogWait.setProgress(i);
// ...
});
return tabledata;
}
In the DialogsService
:
public wait(title: string, message: string, percentage: number, settings?: any): BsModalRef {
// ...
return this.modalService.show(
DialogsComponent,
Object.assign({}, this.options, settings)
);
}
The problem is that the dialog is shown only if the list.forEach
loop is finished. How can show the dialog BEFORE the list is executed? Does anybody have a similar problem and some working code?
Upvotes: 0
Views: 609
Reputation: 8623
The modalService.show should be a synchronize method.
Have you debug the sequence with console.log:
generateDownload(distance: DistanceSplit) {
this.dialogWait = this.dialogs.wait('Wait');
//Adding breakpoint here
console.log('generateDownload');
list.forEach((distance, index) => {
...
this.dialogWait.setProgress(i);
...
});
return tabledata;
}
Upvotes: 0