我遵循的是Ocombe的ng2-translate示例Plunker link。我看到这是System.js的例子
System.config({
//use typescript for compilation
transpiler: 'typescript',
//typescript compiler options
typescriptOptions: {
emitDecoratorMetadata: true
},
paths: {
'npm:': 'https://unpkg.com/'
},
//map tells the System loader where to look for things
map: {
'app': "./src",
'ng2-translate': 'npm:ng2-translate',
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
..........
..........
}如何使用webpack配置ng2-translate?在哪里我必须提到en.json和fr.json文件的路径(路径-src/main/app/assets/i18n/.json)在webpack配置文件中?
发布于 2017-07-19 18:59:54
嘿,我猜你需要把这个函数添加到你的app.module中:
export function HttpLoaderFactory(http: Http) {
return new TranslateHttpLoader(http, "assets/i18n/", ".json");
}https://stackoverflow.com/questions/40647748
复制相似问题