Skip to content

Commit a920858

Browse files
committed
_afterAllClosed and _afterOpen subjects now delegate to state of parentDialog & removed spaces from inside import braces
1 parent 95f0e01 commit a920858

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/demo-app/dialog/dialog-demo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Component, Inject } from '@angular/core';
2-
import { DOCUMENT } from '@angular/platform-browser';
1+
import {Component, Inject} from '@angular/core';
2+
import {DOCUMENT} from '@angular/platform-browser';
33
import {MdDialog, MdDialogRef, MdDialogConfig} from '@angular/material';
44

55
@Component({

src/lib/dialog/dialog.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,22 @@ import {MdDialogContainer} from './dialog-container';
2222
@Injectable()
2323
export class MdDialog {
2424
private _openDialogsAtThisLevel: MdDialogRef<any>[] = [];
25+
private _afterAllClosedAtThisLevel = new Subject<void>();
26+
private _afterOpenAtThisLevel = new Subject<MdDialogRef<any>>();
2527

2628
/** Keeps track of the currently-open dialogs. */
2729
get _openDialogs(): MdDialogRef<any>[] {
2830
return this._parentDialog ? this._parentDialog._openDialogs : this._openDialogsAtThisLevel;
2931
}
3032

3133
/** Subject for notifying the user that all open dialogs have finished closing. */
32-
private _afterAllClosed = new Subject<void>();
33-
34+
get _afterOpen(): Subject<MdDialogRef<any>> {
35+
return this._parentDialog ? this._parentDialog._afterOpen : this._afterOpenAtThisLevel;
36+
}
3437
/** Subject for notifying the user that a dialog has opened. */
35-
private _afterOpen = new Subject<MdDialogRef<any>>();
38+
get _afterAllClosed(): Subject<void> {
39+
return this._parentDialog ? this._parentDialog._afterAllClosed : this._afterAllClosedAtThisLevel;
40+
}
3641

3742
/** Gets an observable that is notified when a dialog has been opened. */
3843
afterOpen: Observable<MdDialogRef<any>> = this._afterOpen.asObservable();

0 commit comments

Comments
 (0)