我已经使用 ngx-toastr 模块在我的 Angular 应用程序中显示 toastr 它在 Chorme、Firefox 中工作正常但在 IE 中不工作,即它在 ngOninit() 函数中工作但在任何其他函数中不工作 . 从 'ngx-toastr' 导入 { ToastrModule };
最佳答案
在我的例子中,toast 容器显示在 DOM 中,但 toast 本身没有显示。 (您可以检查这是否是您的情况,检查 DOM 并查找容器 div 具有的文本“toast-container”)。
我尝试取消注释 polyfill 行和所有内容,直到我意识到 IE 出于某种原因将 toast 设置为属性“display:none”。
对我有用的是将它添加到我的 styles.scss 中:
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
/* IE10+ CSS styles go here */
.toast {
display: block !important;
}
}
@supports (-ms-accelerator:true) {
/* IE Edge 12+ CSS styles go here */
.toast {
display: block !important;
}
}
希望这对您有所帮助!
关于css - Toastr 服务不适用于 Internet Explorer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59658030/