MdDialogRef不能用作模态对话框

时间:2017-05-07 08:12:15

标签: javascript angular typescript angular-material2

我有一个简单对话框的以下打字稿代码:

import {MdDialogRef} from "@angular/material";
import {Component, Optional} from "@angular/core";

@Component({
template: `
    <div class='panel-body' align="center">
            Your email address:<input #emailAddressInput>
           <button md-button (click)="dialogRef.close(emailAddressInput.value)">OK</button>
    </div>
`
})

export class EmailDialogContent {
    constructor(@Optional() public dialogRef: MdDialogRef<EmailDialogContent>) { }
}

打开用户对话框:

    openSimpleDialog(): void {
    this.dialogRef = this._dialog.open(EmailDialogContent, {
        disableClose: false,
        width: '500px',
        position:{bottom:'100%', left:'710px', right:'100%'}});

    this.dialogRef.afterClosed().subscribe(result => {
        console.log("email address:" + result);
    })

}

问题是我的对话框不像Modal对话框那样 当对话框打开时,我可以继续点击我页面上的其他内容 并在模态外单击不会关闭它

任何想法?

0 个答案:

没有答案