Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/lib/dialog/dialog-content-directives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import {Directive, Input, Optional, OnInit} from '@angular/core';
import {Directive, Input, OnChanges, OnInit, Optional, SimpleChanges} from '@angular/core';
import {MdDialogRef} from './dialog-ref';
import {MdDialogContainer} from './dialog-container';

Expand All @@ -25,17 +25,27 @@ let dialogElementUid = 0;
'type': 'button', // Prevents accidental form submits.
}
})
export class MdDialogClose {
export class MdDialogClose implements OnChanges {
/** Screenreader label for the button. */
@Input('aria-label') ariaLabel: string = 'Close dialog';

/** Dialog close input. */
@Input('md-dialog-close') dialogResult: any;

/** Dialog close input for compatibility mode. */
@Input('mat-dialog-close') set _matDialogClose(value: any) { this.dialogResult = value; }
@Input('matDialogClose') _matDialogClose: any;
@Input('mdDialogClose') _mdDialogClose: any;
@Input('mat-dialog-close') _matDialogCloseResult: any;

constructor(public dialogRef: MdDialogRef<any>) { }

ngOnChanges(changes: SimpleChanges) {
const proxiedChange = changes._matDialogClose || changes._mdDialogClose ||
changes._matDialogCloseResult;

if (proxiedChange) {
this.dialogResult = proxiedChange.currentValue;
}
}
}

/**
Expand Down