angular - Angular: Close a MatDialog
问题描述
I am opening a loading MatDialog when I make a HTTP request. However when I try to close it in the subscription of the call it doesnt close it.
What am I doing wrong?
saveListOfSteps(isFormValid: boolean): void{
if(isFormValid== false){
alert("You have not filled out all fields in the form! Fix that first");
}else{
// show a loading dialog
let dialogRefLoading = this.dialog.open(PopupComponent, {
width: '250px',
data: {
data: ["Loading..."],
showCloseButton: false},
},
);
dialogRefLoading.close;
this.SelfServiceDetailsService.saveListOfSteps(this.validationSteps)
.subscribe(response=>{
dialogRefLoading.close;
this.showSaveResultsDialog(response.body),
error => alert("An error occured")});
}
}
解决方案
close
is function so you have to call it like
dialogRefLoading.close();
instead of
dialogRefLoading.close;
推荐阅读
- java - 如何根据设备有效地改变布局
- python - 在衍生进程中读取 OS 环境变量
- haskell - 了解 Haskell 中的折叠
- java - 如何在 Firebase 上使用日期作为键对值进行排序
- python - 后端更改后如何更新Django的模板
- laravel - 在 laravel 上使用 get 和 first 时模型和查询构建器方法的区别?
- c# - Unity 在运行时使用导入器翻转 obj 中的 x 坐标
- angularjs - ng-change 事件只能在输入完成后调用
- node.js - Redux:在做其他事情之前等待状态变化
- hazelcast-jet - Jet map 聚合性能瓶颈:如何避免本地记录的序列化?