NullInjectorError:没有TranslateService的提供程序 从'@angular/platform browser'导入{BrowserModule}; 从“@angular/common/http”导入{HttpClient,HttpClientModule}; 从“@angular/core”导入{Injector,APP_初始化器,NgModule}; 从“@angular/common”导入{LOCATION_INITIALIZED}”; 从'@ngx translate/core'导入{TranslateModule,TranslateLoader,TranslateService}; 从'@ngx translate/http loader'导入{TranslateHttpLoader}; 从“AngularSlickgridModule、GridOdataService、ResizerService”导入{AngularSlickgridModule、GridOdataService、ResizerService}; 从“./app.component”导入{AppComponent}; 从“./firstgrid/firstgrid.component”导入{FirstgridComponent}; 导出函数createTranslateLoader(http:HttpClient){ 返回新的TranslateHttpLoader(http,“./assets/i18n/”,“.json”); } 导出函数appInitializerFactory(翻译:翻译服务,注入器:注入器){ return()=>新承诺((解析:any)=>{ const locationInitialized=injector.get(LOCATION_INITIALIZED,Promise.resolve(null)); locationInitialized。然后(()=>{ 常量langToSet='en'; translate.setDefaultLang('en'); translate.use(langToSet).subscribe(()=>{ //info(`Successfully initialized'${langToSet}'language'`); },err=>{ console.error(`Problem with'${langToSet}'语言初始化'`); }, () => { 解析(空); }); }); }); } @NGD模块({ 声明:[ 应用组件, 第一网格组件 ], 进口:[ 浏览器模块, HttpClientModule, TranslateModule.forRoot({ 加载器:{ 提供:TranslateLoader, useFactory:(createTranslateLoader), deps:[HttpClient] } }) ], 供应商:[ { 提供:应用程序初始化器, useFactory:appInitializerFactory, 副总裁:[翻译服务,注入器], 多:真的 }, 网格服务, ResizerService ], 引导:[AppComponent] }) 导出类AppModule{}

NullInjectorError:没有TranslateService的提供程序 从'@angular/platform browser'导入{BrowserModule}; 从“@angular/common/http”导入{HttpClient,HttpClientModule}; 从“@angular/core”导入{Injector,APP_初始化器,NgModule}; 从“@angular/common”导入{LOCATION_INITIALIZED}”; 从'@ngx translate/core'导入{TranslateModule,TranslateLoader,TranslateService}; 从'@ngx translate/http loader'导入{TranslateHttpLoader}; 从“AngularSlickgridModule、GridOdataService、ResizerService”导入{AngularSlickgridModule、GridOdataService、ResizerService}; 从“./app.component”导入{AppComponent}; 从“./firstgrid/firstgrid.component”导入{FirstgridComponent}; 导出函数createTranslateLoader(http:HttpClient){ 返回新的TranslateHttpLoader(http,“./assets/i18n/”,“.json”); } 导出函数appInitializerFactory(翻译:翻译服务,注入器:注入器){ return()=>新承诺((解析:any)=>{ const locationInitialized=injector.get(LOCATION_INITIALIZED,Promise.resolve(null)); locationInitialized。然后(()=>{ 常量langToSet='en'; translate.setDefaultLang('en'); translate.use(langToSet).subscribe(()=>{ //info(`Successfully initialized'${langToSet}'language'`); },err=>{ console.error(`Problem with'${langToSet}'语言初始化'`); }, () => { 解析(空); }); }); }); } @NGD模块({ 声明:[ 应用组件, 第一网格组件 ], 进口:[ 浏览器模块, HttpClientModule, TranslateModule.forRoot({ 加载器:{ 提供:TranslateLoader, useFactory:(createTranslateLoader), deps:[HttpClient] } }) ], 供应商:[ { 提供:应用程序初始化器, useFactory:appInitializerFactory, 副总裁:[翻译服务,注入器], 多:真的 }, 网格服务, ResizerService ], 引导:[AppComponent] }) 导出类AppModule{},angular,Angular,我在angular中创建slikgrid组件。我正在导入所有库,但出现以下错误 GridBasicComponent.html:5 ERROR Error: StaticInjectorError(AppModule)[AngularSlickgridComponent -> TranslateService]: StaticInjectorError(Platform: core)[AngularSlickgridComponent -> TranslateService]:

我在angular中创建slikgrid组件。我正在导入所有库,但出现以下错误

GridBasicComponent.html:5 ERROR Error: StaticInjectorError(AppModule)[AngularSlickgridComponent -> TranslateService]: 
  StaticInjectorError(Platform: core)[AngularSlickgridComponent -> TranslateService]: 
    NullInjectorError: No provider for TranslateService!
    at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (core.js:1062)
    at resolveToken (core.js:1300)
    at tryResolveToken (core.js:1244)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:1141)
    at resolveToken (core.js:1300)
    at tryResolveToken (core.js:1244)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:1141)
    at resolveNgModuleDep (core.js:8369)
    at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (core.js:9057)
    at resolveDep (core.js:9422)
在编写代码之后,我得到了一个错误“slick.cellrangedecorator.js:72 Uncaught ReferenceError:jQuery未定义”。 在终端错误中,类似于--
节点_模块/angular slickgrid/app/modules/angular slickgrid/filter conditions/index.d.ts(2,35)中出错:错误TS1005:“;”应为。

您是否注入了
TranslateService
?你是怎么注射的。你能给我们看看你的密码吗?是的。是的。从'@ngx translate/core'导入{TranslateModule,TranslateLoader,TranslateService};提供者:[{provide:APP_INITIALIZER,useFactory:appInitializerFactory,deps:[TranslateService,Injector],multi:true}]@santanuDhabal你在appMudule中添加了
TranslateModule.forRoot()
?我也在添加这个。forRoot({loader:{provide:TranslateLoader,useFactory:(createTranslateLoader),deps:[HttpClient]})当我们只有很少的信息时,很难解决这个问题。如果您可以在app.module中发布一些代码,这将非常有用。还有,你什么时候得到错误?是在发球过程中吗?这是IDE的编译错误吗?这是运行时错误吗?