Angular ngx translate.pipe不是一个函数

Angular ngx translate.pipe不是一个函数,angular,ngx-translate,Angular,Ngx Translate,使用ngx translate时,我遇到以下错误: this.currentLoader.getTranslation(...).pipe is not a function at TranslateService.getTranslation (core.es5.js:3171) at TranslateService.retrieveTranslations (core.es5.js:3157) at TranslateService.setDefaultLang (core.es5.js:

使用ngx translate时,我遇到以下错误:

this.currentLoader.getTranslation(...).pipe is not a function
at TranslateService.getTranslation (core.es5.js:3171)
at TranslateService.retrieveTranslations (core.es5.js:3157)
at TranslateService.setDefaultLang (core.es5.js:3098)
at new AppComponent (app.component.ts:11)
at createClass (core.js:12470)
at createDirectiveInstance (core.js:12315)
at createViewNodes (core.js:13776)
at createRootView (core.js:13665)
at callWithDebugContext (core.js:15090)
at Object.debugCreateRootView [as createRootView] (core.js:14373)
这是我的应用程序组件:

import { Component } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';

@Component({
    selector: 'app',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
})
export class AppComponent {
    constructor(private translate: TranslateService) {
        translate.setDefaultLang('en');
        translate.use('en');
    }
}
这里我导入模块,并在上面使用import声明它

 imports: [
            TranslateModule.forRoot()
    ]
我还在导入TranslateService:

providers: [
        TranslateService
    ],
如果我删除构造函数中的行,我不会得到错误,但这意味着我也不会有翻译。 我在以下位置创建了一个json文件: ClientApp/assets/i18n/en.json

...
import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
import {TranslateHttpLoader} from '@ngx-translate/http-loader';
...

// AoT requires an exported function for factories
export function HttpLoaderFactory(http: HttpClient) {
    return new TranslateHttpLoader(http);
}

@NgModule({
    imports: [
       BrowserModule,
       HttpClientModule,
       TranslateModule.forRoot({
          loader: {
            provide: TranslateLoader,
            useFactory: HttpLoaderFactory,
            deps: [HttpClient]
          }
      })
   ],
   bootstrap: [AppComponent]
 })
 export class AppModule { }
我在VisualStudio提供的.net核心模板上运行它。我将模板从Angular 4升级到Angular 5。其他插件工作正常,我只是无法找出错误

以下是版本: -“@ngx translate/core”:“9.1.1”, -“@ngx翻译/http加载程序”:“2.0.1” -Angular 5.1.1

您需要使用从“/assets/i18n/en.json”加载翻译


它与@ngx translate/core v8.0.0配合使用 对于9.1.1,我也有同样的问题

package.json
“@ngx translate/core”:“8.0.0”

您在哪里使用这个?这个.currentLoader.getTranslation(…)?我不是。这是我为它写的所有代码。我使用angular 5.2和.NETCore2将项目移植到新模板。它在那里工作!