Skip to content

Commit

Permalink
_afterAllClosed and _afterOpen subjects now delegate to state of pare…
Browse files Browse the repository at this point in the history
…ntDialog & removed spaces from inside import braces
  • Loading branch information
thomaspink committed Jan 14, 2017
1 parent 8812723 commit 8e45d31
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/demo-app/dialog/dialog-demo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, Inject } from '@angular/core';
import { DOCUMENT } from '@angular/platform-browser';
import {Component, Inject} from '@angular/core';
import {DOCUMENT} from '@angular/platform-browser';
import {MdDialog, MdDialogRef, MdDialogConfig} from '@angular/material';

@Component({
Expand Down
11 changes: 8 additions & 3 deletions src/lib/dialog/dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,22 @@ import {MdDialogContainer} from './dialog-container';
@Injectable()
export class MdDialog {
private _openDialogsAtThisLevel: MdDialogRef<any>[] = [];
private _afterAllClosedAtThisLevel = new Subject<void>();
private _afterOpenAtThisLevel = new Subject<MdDialogRef<any>>();

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

/** Subject for notifying the user that all open dialogs have finished closing. */
private _afterAllClosed = new Subject<void>();

get _afterOpen(): Subject<MdDialogRef<any>> {
return this._parentDialog ? this._parentDialog._afterOpen : this._afterOpenAtThisLevel;
}
/** Subject for notifying the user that a dialog has opened. */
private _afterOpen = new Subject<MdDialogRef<any>>();
get _afterAllClosed(): Subject<void> {
return this._parentDialog ? this._parentDialog._afterAllClosed : this._afterAllClosedAtThisLevel;
}

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

0 comments on commit 8e45d31

Please sign in to comment.