垫对话框关闭按钮在iOS设备上不起作用
我使用 Angular 13 用于我的应用。我使用了 Angular-Material Mat-Dialog Box 作为弹出模式。这是提交和关闭按钮的 html 代码。
<mat-dialog-actions>
<button class="btn" mat-raised-button color="accent" (click)="closeModal()">
<span class="btn-text">CLOSE</span>
</button>
<button class="btn" mat-raised-button style="background-color: #CF466F;" (click)="deleteAd(data.id)">
<span *ngIf="loading" class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
<span *ngIf="!loading" class="btn-text">YES, DELETE</span>
</button>
一切都在桌面&amp;中正常工作。 Android 移动设备。但是它在 iOS 设备中无法正常工作。此处提交按钮在我的I Phone( iOS版本12.5.5 )中正常运行。但是关闭按钮不起作用。当弹出模态时,由于关闭按钮无法正常运行,因此无法关闭它。
这是我的 打字稿 代码。
closeModal(): void {
this.ngZone.run(() => {
this.dialogRef.close();
});
}
有人可以帮我吗?
Im using Angular 13 for my application. And I used angular-material Mat-Dialog box as a pop up modal. This is the HTML code of the submit and close buttons.
<mat-dialog-actions>
<button class="btn" mat-raised-button color="accent" (click)="closeModal()">
<span class="btn-text">CLOSE</span>
</button>
<button class="btn" mat-raised-button style="background-color: #CF466F;" (click)="deleteAd(data.id)">
<span *ngIf="loading" class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
<span *ngIf="!loading" class="btn-text">YES, DELETE</span>
</button>
Everything worked properly in Desktop & Android mobile devices. But it's not working properly in IOS devices. Here submit button is functioning as expected in my I phone (IOS version 12.5.5). But the close button is not working. And when the modal is poped up, it cant be closed since the close button is not functioning.
This is my Typescript code.
closeModal(): void {
this.ngZone.run(() => {
this.dialogRef.close();
});
}
Can someone help me with this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我在关闭MAT-DIALOG问题的应用程序中也遇到了同样的问题,该应用程序在Angular14中后来升级为Angular15,我通过为最新的JavaScript功能添加polyfills来解决此问题,
以便我安装了一些依赖关系,
我将这些polyfills添加到了我的多填充物中。 我的pollyfills.ts之后的ts文件
看起来
您可以通过仅通过引用文档 https://github.com/zloirock/core-js#readme
下面的文章帮助我在此解决方案 https://dev.to/coly010/angular-how-to-support-ie11-4924
I had the same issue in closing mat-dialog issue in my application which is in angular14 later i upgraded into angular15, i fixed this issue by adding polyfills for latest javascript features
for that i have installed some dependencies
i added these polyfills to my polyfills.ts file
after my pollyfills.ts looks like
you can configure importing core.js by adding specific features only by referring documentation https://github.com/zloirock/core-js#readme
below article helpmed me to reach at this solution https://dev.to/coly010/angular-how-to-support-ie11-4924
我在Angular版本13.2.0中也遇到了同样的问题。我还有另一个具有13.0.2版本的项目,它可以使用。对于我来说,它也无法与14版或更高的13.x一起使用。
因此,快速修复将降级。
I had the same problem in Angular version 13.2.0. I have another project with version 13.0.2 and there it works. It also did not work with version 14 or a higher 13.x for me.
So a quick fix would be downgrading.
我也有同样的问题!您必须禁用iOS&lt; = 13的动画!
我在这里找到了解决方案:
https://github.com/angular/angular/angular/angular/angular/issues/45016
app.module .ts
I had the same problem! You have to disable animations for IOS <=13 !
I found the solution here:
https://github.com/angular/angular/issues/45016
app.module.ts