css - Toastr 服务不适用于 Internet Explorer

标签 css angular ngx-toastr

我已经使用 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/

相关文章:

ngx-toastr.js?4996 :264 Uncaught TypeError: Object(. ..) 不是 eval 中的函数 (ngx-toastr.js?4996:264)

ios - UIWebView 的内容背景颜色不透明

html - 如何考虑使用@media 的大多数手机屏幕?

css - body 标签中的多个类、多维 css 结构或精神错乱的蓝图?

css - 在 ng FlexLayout 中缩放图像

angular - 使用 typescript 在 Angular 6 中自定义 Ngx-toastr

css - 无法垂直滚动

Angular 2 或 4 Reactive 表单集验证依赖于另一个字段值

javascript - Angular 编译错误 : src/app/login/login. component.ts(18,10): 错误 TS1127: 无效的 > 字符