服务SB Admin Bootstrap 4模板时,en.json'Not Found'

时间:2017-08-24 03:56:58

标签: angular angular-cli zone.js

我正在使用此模板:

https://github.com/start-angular/SB-Admin-BS4-Angular-4

ng serve上,它总是在控制台中抛出错误:

  

GET   http://localhost:4200/start-angular/SB-Admin-BS4-Angular-4/master/dist/assets/i18n/en.json   404(未找到) - zone.js:2263

     

ERROR Response {_body:“↵↵↵↵↵↵”,状态:404,   ok:false,statusText:“Not Found”,header:Headers,...}   core.es5.js:1020

您如何解决该错误?

1 个答案:

答案 0 :(得分:2)

en.json的路径错误 它应该类似于http://localhost:4200/assets/i18n/en.json

<强>更新
我只是寻找来源。您需要使用app.module.ts文件行14和13 https://github.com/start-angular/SB-Admin-BS4-Angular-4/blob/master/src/app/app.module.ts#L14

进行游戏
export function HttpLoaderFactory(http: Http) {
    // for development
    // return new TranslateHttpLoader(http, '/start-angular/SB-Admin-BS4-Angular-4/master/dist/assets/i18n/', '.json');
    return new TranslateHttpLoader(http, '/assets/i18n/', '.json');
}