角产品生成为ng2-daterangepicker插件提供错误

问题描述

在制作产品时,我遇到了ng2-daterangepicker的问题。

ERROR NullInjectorError: StaticInjectorError(AppModule)[DaterangepickerComponent -> DaterangepickerConfig]: 
  StaticInjectorError(Platform: core)[DaterangepickerComponent -> DaterangepickerConfig]: 
    NullInjectorError: No provider for DaterangepickerConfig!
    at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (http://localhost:9000/main.1c670d3f26f8f3342a59.js:28824:25)
    at resolvetoken (http://localhost:9000/main.1c670d3f26f8f3342a59.js:40016:24)
    at tryResolvetoken (http://localhost:9000/main.1c670d3f26f8f3342a59.js:39960:16)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (http://localhost:9000/main.1c670d3f26f8f3342a59.js:39862:20)
    at resolvetoken (http://localhost:9000/main.1c670d3f26f8f3342a59.js:40016:24)
    at tryResolvetoken (http://localhost:9000/main.1c670d3f26f8f3342a59.js:39960:16)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (http://localhost:9000/main.1c670d3f26f8f3342a59.js:39862:20)
    at resolveNgModuleDep (http://localhost:9000/main.1c670d3f26f8f3342a59.js:48299:29)
    at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (http://localhost:9000/main.1c670d3f26f8f3342a59.js:48974:16)
    at resolveDep (http://localhost:9000/main.1c670d3f26f8f3342a59.js:49346:45)

Plugin在本地和开发版本中都可以使用,但在产品版本中则不能使用

角度细节:


    Angular CLI: 8.3.29
    Node: 10.16.0
    OS: win32 x64
    Angular: 8.2.14
    ... animations,common,compiler,compiler-cli,core,forms
    ... language-service,platform-browser,platform-browser-dynamic
    ... router
    
    Package                           Version
    -----------------------------------------------------------
    @angular-devkit/architect         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/core              8.3.29
    @angular-devkit/schematics        8.3.29
    @angular/cdk                      8.2.3
    @angular/cli                      8.3.29
    @angular/material                 8.2.3
    @ngtools/webpack                  8.3.29
    @schematics/angular               8.3.29
    @schematics/update                0.803.29
    rxjs                              6.4.0
    typescript                        3.5.3
    webpack                           4.39.2

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

解决方法

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

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

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...