I'm trying to figure out how to open the next dialog from a stream only after the previous one has been closed. I want to make sure that I don't open all the dialogs in a row as soon as I get the values from the stream.
const arraySource = from(res);
arraySource.pipe().subscribe(code => {
console.log('value: ', code);
const description = this.locale.getDescription(code);
const config = new MatDialogConfig();
config.data = {code: code, description: description.value};
this.validationDialogRef = this.dialog.open(ValidationDialog, config);
this.validationDialogRef.afterClosed().subscribe(data => {
console.log("data returned from mat-dialog-close is ", this.validationDialogRef, data);
});
})
Using the take(1) operator, I am only able to get the first element from the array in the dialog. Without using take(1), all the dialogs will pop up at once. Is there a way to trigger the scheduler only when the previous dialog has been closed?
Best regards,