Skip to content

Commit e7712cb

Browse files
committed
Remove the closeTop method and use the dialogRef instead.
1 parent cf767fe commit e7712cb

File tree

3 files changed

+3
-29
lines changed

3 files changed

+3
-29
lines changed

src/lib/dialog/dialog-content-directives.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Directive} from '@angular/core';
2-
import {MdDialog} from './dialog';
2+
import {MdDialogRef} from './dialog-ref';
33

44

55
/**
@@ -8,11 +8,11 @@ import {MdDialog} from './dialog';
88
@Directive({
99
selector: 'button[md-dialog-close], button[mat-dialog-close]',
1010
host: {
11-
'(click)': 'dialog.closeTop()'
11+
'(click)': 'dialogRef.close()'
1212
}
1313
})
1414
export class MdDialogClose {
15-
constructor(public dialog: MdDialog) { }
15+
constructor(public dialogRef: MdDialogRef<any>) { }
1616
}
1717

1818
/**

src/lib/dialog/dialog.spec.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -227,21 +227,6 @@ describe('MdDialog', () => {
227227
expect(overlayContainerElement.querySelectorAll('md-dialog-container').length).toBe(0);
228228
});
229229

230-
it('should close the top dialog', () => {
231-
dialog.open(PizzaMsg);
232-
dialog.open(PizzaMsg);
233-
234-
expect(overlayContainerElement.querySelectorAll('md-dialog-container').length).toBe(2);
235-
236-
dialog.closeTop();
237-
238-
expect(overlayContainerElement.querySelectorAll('md-dialog-container').length).toBe(1);
239-
240-
dialog.closeTop();
241-
242-
expect(overlayContainerElement.querySelectorAll('md-dialog-container').length).toBe(0);
243-
});
244-
245230
describe('disableClose option', () => {
246231
it('should prevent closing via clicks on the backdrop', () => {
247232
dialog.open(PizzaMsg, {

src/lib/dialog/dialog.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,6 @@ export class MdDialog {
5757
}
5858
}
5959

60-
/**
61-
* Closes the top dialog
62-
*/
63-
closeTop(): void {
64-
let dialogs = this._openDialogs.length;
65-
66-
if (dialogs) {
67-
this._openDialogs[dialogs - 1].close();
68-
}
69-
}
70-
7160
/**
7261
* Creates the overlay into which the dialog will be loaded.
7362
* @param dialogConfig The dialog configuration.

0 commit comments

Comments
 (0)