【问题标题】:ng2-toastr with akveo/ng2-admin - CSS not taken into account带有 akveo/ng2-admin 的 ng2-toastr - 未考虑 CSS
【发布时间】:2017-04-22 12:13:18
【问题描述】:

我正在使用 akveo/ng2-admin 仪表板(最新的 angular 4)并尝试按照安装文档使用 ng2-toastr。

我在 index.html 文件中导入了 CSS,并在 app.module.ts 文件中声明了 ToastModule。

我还在组件中导入了 ToastsManager 并分配了 ViewContainerRef。

模块已成功加载,到目前为止一切正常。

但是当我调用this.toastr.success('You are awesome!', 'Success!'); 时,文本会在不使用 CSS 的情况下显示。

ng2-admin 正在使用 WebPack。

有什么想法吗?

提前致谢! 塞尔吉。

URL toastr:https://github.com/PointInside/ng2-toastr

网址 ng2-admin:enter link description here

【问题讨论】:

    标签: angular typescript toastr


    【解决方案1】:

    我复制了 theme 文件夹中的 CSS 文件,并使用以下命令将其加载到 app.component.ts 中:

    import 'style-loader!./theme/ng2-toastr/ng2-toastr.scss';
    

    干杯, 塞尔吉。

    【讨论】:

      【解决方案2】:

      添加

      @import '../node_modules/ng2-toastr/ng2-toastr.css'; 
      

      ./src/app/theme/theme.cscc

      这个文件是用来添加全局样式或导入其他文件的,这样我们就可以避免复制文件

      【讨论】:

      • 但是之后,我会将它转译到 dist 目录中的生产系统,并且我需要将 css 放在 assets 目录中才能考虑到。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多