我的项目中的所有对话框都不会在IE11中为我部署的代码打开,但在IE中本地运行时效果很好。它们都遵循相同的代码。
component.html
<button mat-raised-button color="accent" class="accent" type="button" (click)="openNewCaseModal()" [disabled]="disableSubmit">{{ 'CASES.createCase' | translate }}</button>
component.ts
openNewCaseModal(row)
const dialogRef = this.dialog.open(CaseComponent, {
width: '75%',
data: this.caseData
});
dialogRef.afterClosed().subscribe(result => {
if (result === 'submitted') {
this.caseCreated.emit();
this.snackbar.open('Case Created', '', { duration: 2000, verticalPosition: 'top' } );
} else if (result === 'error submitted') {
this.snackbar.open('Error Creating Case. Please Try Again.', '', { duration: 2000, verticalPosition: 'top' });
}
});
}
dialog.component.ts
constructor(
private caseService: CasesService,
private sidebarService: SidebarService,
private dialog: MatDialogRef<CaseComponent>,
private fb: FormBuilder,
private snackbar: MatSnackBar,
@Inject(MAT_DIALOG_DATA) public data: any) {
}
当我尝试打开对话框时,在IE控制台中出现我的错误。
错误:StaticInjectorError [e-> function(){this.role =“ dialog”,this.panelClass =“”,this.hasBackdrop =!0,this.backdropClass =“”,this.disableClose =!1,this.width =“”,this.height =“”,this.maxWidth =“ 80vw”,this.data = null,this.ariaDescribedBy = null,this.ariaLabel = null,this.autoFocus =!0,this.restoreFocus =!0,this.closeOnNavigation =!0 }]:
StaticInjectorError(平台:核心)[e-> function(){this.role =“ dialog”,this.panelClass =“”,this.hasBackdrop =!0,this.backdropClass =“”,this.disableClose =!1,this.width =“”,this.height =“”,this.maxWidth =“ 80vw”,this.data = null,this.ariaDescribedBy = null,this.ariaLabel = null,this.autoFocus =!0,this.restoreFocus =!0,this.closeOnNavigation =!0 }]:
NullInjectorError:没有提供者 function(){this.role =“ dialog”,this.panelClass =“”,this.hasBackdrop =!0,this.backdropClass =“”,this.disableClose =!1,this.width =“”,this.height =“”,this.maxWidth =“ 80vw”,this.data = null,this.ariaDescribedBy = null,this.ariaLabel = null,this.autoFocus =!0,this.restoreFocus =!0,this.closeOnNavigation =!0 }!
这些错误似乎是指我正在调用以打开对话框的this.dialog.open()函数。另外,我只能在已部署的代码中重现它的事实也使调试变得困难。
任何帮助/建议将不胜感激。
答案 0 :(得分:1)
问题在于pollyfills.ts文件中缺少pollyfils。
我错过了以下pollyfill进口商品:
我的猜测是在错误中:
StaticInjectorError(平台:核心)[e-> function(){this.role =“ dialog”,this.panelClass =“”,this.hasBackdrop =!0,this.backdropClass =“”,this.disableClose =!1,this.width =“”,this.height =“”,this.maxWidth =“ 80vw”,this.data = null,this.ariaDescribedBy = null,this.ariaLabel = null,this.autoFocus =!0,this.restoreFocus =!0,this.closeOnNavigation =!0 }]:
(平台:核心)部分指的是core-js。没有其他迹象表明这是正确的,但对话框现在正在运行。
感谢@yurzui提供有关解决错误的建议。