AngularonDestroy在MatDialog显示之前被调用
创始人
2024-10-28 19:01:02
0

在调用MatDialog的时候添加afterClosed()方法,并在该方法中进行需要在 MatDialog 中完成的操作,以确保它们在对话框关闭后执行。

示例代码如下:

import { MatDialog } from '@angular/material/dialog';

export class MyComponent implements OnDestroy { dialogRef: MatDialogRef;

constructor(private dialog: MatDialog) {}

openDialog(): void { this.dialogRef = this.dialog.open(MyDialogComponent);

this.dialogRef.afterClosed().subscribe(result => {
  // 在此处添加需要在 MatDialog 中完成的操作
});

}

ngOnDestroy() { if (this.dialogRef) { this.dialogRef.close(); } } }

相关内容

热门资讯

日前!德普之星透视辅助软件是真... 日前!德普之星透视辅助软件是真的吗,微乐游戏竞技团辅助,必备透视(竟然有挂)-哔哩哔哩1、德普之星透...
透视辅助!wpk透视辅助方法,... 透视辅助!wpk透视辅助方法,wpk模拟器多开(透视)一直有技巧(哔哩哔哩)1、辅助软件下载优化,底...
这一问题亟待解决!agpoke... 这一问题亟待解决!agpoker辅助,微信小程序微乐跑得快技巧,透视透视(有挂解密)-哔哩哔哩在进入...
脚本总结!hhpoker透视脚... 脚本总结!hhpoker透视脚本下载,hhpoker到底可以作必弊吗(透视)其实是有方法(哔哩哔哩)...
透视线上!红龙poker作必弊... 透视线上!红龙poker作必弊指令,微乐家乡脚本助手,开挂透视(有挂规律)-哔哩哔哩运红龙poker...
脚本专业!德普软件,德普之星辅... 脚本专业!德普软件,德普之星辅助工具如何设置(透视)真是存在有插件(哔哩哔哩)1、免费脚本咨询教程、...
于此同时!steampoker... 于此同时!steampokermaster辅助,微信小程序微乐房间怎么开挂,总结脚本(有挂攻略)-哔...
据目击者称!wepoker手机... 据目击者称!wepoker手机版辅助,微乐小程序授权,详情透视(证实有挂)-哔哩哔哩1.wepoke...
透视普及!aapoker透视脚... 透视普及!aapoker透视脚本下载,aapoker透视怎么用(透视)切实是真的技巧(哔哩哔哩)1、...
透视插件!hhpoker德州挂... 透视插件!hhpoker德州挂真的有吗,陕西微乐小程序辅助,分享脚本(有挂工具)-哔哩哔哩暗藏猫腻,...