File tree 3 files changed +12
-20
lines changed
3 files changed +12
-20
lines changed Original file line number Diff line number Diff line change @@ -27,12 +27,12 @@ export class DialogDemo {
27
27
// Possible useful example for the open and closeAll events.
28
28
// Adding a class to the body if a dialog opens and
29
29
// removing it after all open dialogs are closed
30
- dialog . afterOpen ( ) . subscribe ( ( ref : MdDialogRef < any > ) => {
30
+ dialog . afterOpen . subscribe ( ( ref : MdDialogRef < any > ) => {
31
31
if ( ! doc . body . classList . contains ( 'no-scroll' ) ) {
32
32
doc . body . classList . add ( 'no-scroll' ) ;
33
33
}
34
34
} ) ;
35
- dialog . afterAllClosed ( ) . subscribe ( _ => {
35
+ dialog . afterAllClosed . subscribe ( ( ) => {
36
36
doc . body . classList . remove ( 'no-scroll' ) ;
37
37
} ) ;
38
38
}
Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ describe('MdDialog', () => {
137
137
138
138
it ( 'should notify the observers if a dialog has been opened' , ( ) => {
139
139
let ref : MdDialogRef < PizzaMsg > ;
140
- dialog . afterOpen ( ) . subscribe ( r => {
140
+ dialog . afterOpen . subscribe ( r => {
141
141
ref = r ;
142
142
} ) ;
143
143
expect ( dialog . open ( PizzaMsg , {
@@ -154,7 +154,7 @@ describe('MdDialog', () => {
154
154
} ) ;
155
155
let allClosed = false ;
156
156
157
- dialog . afterAllClosed ( ) . subscribe ( _ => {
157
+ dialog . afterAllClosed . subscribe ( ( ) => {
158
158
allClosed = true ;
159
159
} ) ;
160
160
Original file line number Diff line number Diff line change @@ -25,10 +25,16 @@ export class MdDialog {
25
25
private _openDialogs : MdDialogRef < any > [ ] = [ ] ;
26
26
27
27
/** Subject for notifying the user that all open dialogs have finished closing. */
28
- private _afterAllClosed : Subject < any > = new Subject ( ) ;
28
+ private _afterAllClosed = new Subject < void > ( ) ;
29
29
30
30
/** Subject for notifying the user that a dialog has opened. */
31
- private _afterOpen : Subject < any > = new Subject ( ) ;
31
+ private _afterOpen = new Subject < MdDialogRef < any > > ( ) ;
32
+
33
+ /** Gets an observable that is notified when a dialog has been opened. */
34
+ afterOpen = this . _afterOpen . asObservable ( ) ;
35
+
36
+ /** Gets an observable that is notified when all open dialog have finished closing. */
37
+ afterAllClosed = this . _afterAllClosed . asObservable ( ) ;
32
38
33
39
constructor ( private _overlay : Overlay , private _injector : Injector ) { }
34
40
@@ -67,20 +73,6 @@ export class MdDialog {
67
73
}
68
74
}
69
75
70
- /**
71
- * Gets an observable that is notified when a dialog has been opened.
72
- */
73
- afterOpen ( ) : Observable < any > {
74
- return this . _afterOpen . asObservable ( ) ;
75
- }
76
-
77
- /**
78
- * Gets an observable that is notified when all open dialog have finished closing.
79
- */
80
- afterAllClosed ( ) : Observable < any > {
81
- return this . _afterAllClosed . asObservable ( ) ;
82
- }
83
-
84
76
/**
85
77
* Creates the overlay into which the dialog will be loaded.
86
78
* @param dialogConfig The dialog configuration.
You can’t perform that action at this time.
0 commit comments