繁体   English   中英

MatDialog无法在IE 11中打开

[英]MatDialog not opening in IE 11

我的项目中的所有对话框都不会在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(Platform:core)[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()函数。 另外,我只能在已部署的代码中复制它,这也使调试变得很困难。

任何帮助/建议将不胜感激。

问题是在pollyfills.ts文件中缺少pollyfils。

我缺少以下pollyfill进口产品:

  • 导入'core-js / es6 / weak-map';
  • 导入'core-js / es7 / reflect';

我的猜测是在错误中:

StaticInjectorError(Platform:core)[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提供有关解决错误的建议。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM