【问题标题】:angular prod build giving error for ng2-daterangepicker pluginangular prod build 给 ng2-daterangepicker 插件错误
【发布时间】:2020-10-12 11:15:19
【问题描述】:

我在进行产品构建时遇到了 ng2-daterangepicker 的问题。

错误 NullInjectorError: StaticInjectorError(AppModule)[DaterangepickerComponent -> DaterangepickerConfig]:
  StaticInjectorError(平台:核心)[DaterangepickerComponent -> DaterangepickerConfig]:
    NullInjectorError:没有 DaterangepickerConfig 的提供者!
    在 NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (http://localhost:9000/main.1c670d3f26f8f3342a59.js:28824:25)
    在 resolveToken (http://localhost:9000/main.1c670d3f26f8f3342a59.js:40016:24)
    在 tryResolveToken (http://localhost:9000/main.1c670d3f26f8f3342a59.js:39960:16)
    在 StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (http://localhost:9000/main.1c670d3f26f8f3342a59.js:39862:20)
    在 resolveToken (http://localhost:9000/main.1c670d3f26f8f3342a59.js:40016:24)
    在 tryResolveToken (http://localhost:9000/main.1c670d3f26f8f3342a59.js:39960:16)
    在 StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (http://localhost:9000/main.1c670d3f26f8f3342a59.js:39862:20)
    在 resolveNgModuleDep (http://localhost:9000/main.1c670d3f26f8f3342a59.js:48299:29)
    在 NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (http://localhost:9000/main.1c670d3f26f8f3342a59.js:48974:16)
    在 resolveDep (http://localhost:9000/main.1c670d3f26f8f3342a59.js:49346:45)

插件在本地和开发版本中都可以工作,但不能在产品版本中工作

角度细节:

角 CLI:8.3.29 节点:10.16.0 操作系统:win32 x64 角度:8.2.14 ... 动画、常见、编译器、编译器-cli、核心、表单 ... 语言服务、平台浏览器、平台浏览器动态 ... 路由器 包版本 -------------------------------------------------- --------- @angular-devkit/架构师 0.803.29 @angular-devkit/build-angular 0.803.29 @angular-devkit/build-optimizer 0.803.29 @angular-devkit/build-webpack 0.803.29 @angular-devkit/核心 8.3.29 @angular-devkit/schematics 8.3.29 @角/cdk 8.2.3 @角/cli 8.3.29 @角/材料8.2.3 @ngtools/webpack 8.3.29 @原理图/角度 8.3.29 @原理图/更新 0.803.29 rxjs 6.4.0 打字稿3.5.3 网络包 4.39.2

插件链接:https://www.npmjs.com/package/ng2-daterangepicker

【问题讨论】:

    标签: angular-cli daterangepicker aot


    【解决方案1】:

    我遇到了完全相同的问题。 通过在声明您的 Daterangepicker 的模块中的提供程序下导入 DaterangepickerConfig 来修复它

    编辑:还必须添加:@import '~ng2-daterangepicker/assets/daterangepicker.css';到样式.css

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-01-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-09-27
      相关资源
      最近更新 更多