javascript - Angular closing material dialog from dialog's child component throws errors
问题描述
I am closing my dialog from dialog's child component :
Dialog.html :
<ng-container>
<app-invoice-form [disabled]="false" [formGroup]="invoiceFormGroup" [hash]="data.hash" [afterPayment]="true">
</app-invoice-form>
</ng-container>
InvoiceForm.ts :
constructor(
public dialogRef: MatDialogRef<InvoiceDialog>
) { }
public goBackToOrder() {
this.dialogRef.close();
this.router.navigate(['/cart', this.hash, true]);
}
When goBackToOrder() fires, everything looks good, dialog closes, router navigates, but then after router navigates i am getting these errors in my console :
ERROR NullInjectorError: R3InjectorError(CartModule)[MatDialogRef -> MatDialogRef -> MatDialogRef -> MatDialogRef]: NullInjectorError: No provider for MatDialogRef!
How to fix this error ?
CartModule imports MatDialogModule.
解决方案
推荐阅读
- java - Android - 单击后无法设置可单击(假)按钮
- r - 变异和/或汇总动态列数
- azure - 在 azure 服务中为长时间运行的任务选择什么?
- android - 无法在 Flutter 中设置状态()
- flutter - Flutter build apk 错误 Dart 快照生成器失败,退出代码为 -1073741819
- html - 覆盖 YT 视频的 PNG - 跨设备的对齐问题
- amazon-web-services - 无法连接到 AWS RDS 上的 SQL Server
- scala - 不同大小数据类型的按位运算
- python - Python,如何从 JSON 数据创建表 - 索引
- c# - 文本框中的 Asp.net C# 印地语字体在 PostBack 中被转换为数字和符号