问题描述
我正在使用Angular 10,并尝试使用ngx-cookiesconsent软件包。我从ngx-cookieconsent收到错误消息:
ERROR in node_modules/ngx-cookieconsent/cookieconsent.module.d.ts:7:53 - error TS2314: Generic type 'ModuleWithProviders<T>' requires 1 type argument(s).
static forRoot(config: NgcCookieConsentConfig): ModuleWithProviders;
我相信我已经正确地将它连接到了app.module.ts文件中,如下所示:
imports: [
NgcCookieConsentModule.forRoot(cookieConfig),BrowserModule,AppRoutingModule,BrowserAnimationsModule,LayoutModule,MaterialModule,HttpClientModule,AccountModule
],
ngx-cookieconsent确实正确声明了该方法(在版本2.2.3中),如https://github.com/tinesoft/ngx-cookieconsent/blob/master/src/cookieconsent.module.ts所示。
我做错什么了吗?
解决方法
我知道了。我的angular.json文件中没有正确的路径。