esq*_*ial 4 mddialog angular-material2 angular
我有一个md-dialog组件- DialogComponent我从同级组件中打开SiblingComponent--我想dialog.component.ts在执行某些操作后将其关闭 。
DialogComponent基本上是带有提交按钮的表单,提交表单使我能够dialog.component.ts执行我正在做的一些验证并将数据发送到服务的功能。
验证通过和数据发送后,我想作出一些超时,然后自动关闭拨号窗口,但我不知道该怎么办好像md-dialog-close在dialog.component.ts
您可以将an MdDialogRef注入对话框组件类,并使用该类将其关闭。例:
export class DialogComponent {
constructor(private dialogRef: MdDialogRef<DialogComponent >) { }
someAction() {
// do your thing here
this.dialogRef.close(); // <- this closes the dialog.
// You can also wrap it in setTimeout() if you want
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3079 次 |
| 最近记录: |