当我使用构建android时出现错误ionic build android
命令
ngc:错误:静态解析符号值时遇到错误。引用本地(非导出)符号“字典”。考虑导出符号(原始.ts文件中的位置14:8),解析符号TRANSLATION_PROVIDERS
我的代码在translation.ts文件中
export const TRANSLATIONS = new OpaqueToken('translations');
// all traslations
const dictionary : any = {
[LANG_EN_NAME]: LANG_EN_TRANS,
[LANG_AR_NAME]: LANG_AR_TRANS,
[LANG_FR_NAME]: LANG_FR_TRANS
};
// providers
export const TRANSLATION_PROVIDERS : any = [
{ provide: TRANSLATIONS, useValue: dictionary},
];
我的 app.module.ts 代码
import {TRANSLATION_PROVIDERS,TranslatePipe,TranslateService} from './translate';
@NgModule({
declarations: [
MyApp,
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
],
providers: [TRANSLATION_PROVIDERS,TranslateService ]
})
export class AppModule {}
顺便说一句,当我使用时,关于这个问题的任何建议ionic serve
通过翻译指挥我的项目 100% 工作