Closed
Description
Bug, feature request, or proposal:
Feature request
Motivation
I have a "top priority" dialog that should dismiss all other dialogs before opening. In order to know when no other dialogs are open, I have to access a docs-private property, _openDialogs
:
openImportantDialog() {
// Start closing each of the open dialogs
this.dialog.closeAll();
// When all dialogs are closed, open the important dialog
this.noDialogsOpen.first().subscribe(() => {
this.dialog.open(MyImportantDialog);
});
}
/** Emits when no dialogs are open */
get noDialogsOpen(): Observable<void> {
if (this.dialog._openDialogs.length) {
return this.dialog.afterAllClosed;
} else {
return this.dialog.afterAllClosed.startWith(null);
}
}
It would be nice if I could do something like
openImportantDialog() {
this.dialog.afterAllClosed.first().subscribe(() => {
this.dialog.open(MyImportantDialog);
});
}
except afterAllClosed
only emits after the final dialog closes, but not when there are no dialogs to begin with.
Suggested behavior
One or both of the following:
_openDialogs
becomesopenDialogs
afterAllClosed
(or a new property) emits immediately to new subscribers if no dialogs are currently opened