core.js:1448错误错误:未捕获(在承诺中):错误:模板解析错误: 管道'翻译'无法找到 当我在componnent.html中使用translat它会工作 这是我在一个文件夹中的索引组件
import { Component, OnInit, ViewEncapsulation, AfterViewInit, Input } from
'@angular/core';
import { Helpers } from '../../helpers';
import { ScriptLoaderService } from '../../_services/script-loader.service';
import {TranslateService , TranslatePipe } from '@ngx-translate/core';
@Component({
selector: "app-index",
templateUrl: "./index.component.html",
encapsulation: ViewEncapsulation.None,
})
export class IndexComponent implements OnInit, AfterViewInit {
@Input() isLogin: number | string;
constructor(private _script: ScriptLoaderService ,private translate:
TranslateService) {
translate.addLangs(['en', 'fr']);
translate.setDefaultLang('en');
translate.use('en');
}
ngOnInit() {
}
ngAfterViewInit() {
this._script.loadScripts('app-index',
['assets/app/js/dashboard.js']);
}
}