我需要从服务器的.properties
文件加载一些数据。如何在角度5.0中加载和读取那种文件?
这是我的尝试:
async resolve(route:ActivatedRouteSnapshot){
const response = await this.getCountryName();
let countryPath = this.countryDetails.countryShortName.toLowerCase() + '_' + this.countryDetails.countryShortName;
let $dataUrl = `/assets/data/${countryPath}/${countryPath}.json`;
let $propUrl = `/assets/data/resource.properties`;
let $dataData = this.http.get($dataUrl);
let $propData = this.http.get($propUrl);
return new Promise((resolve, reject) => {
forkJoin([$dataData,$propData])
.subscribe((data) => {
console.log( 'both', data[0], data[1] );
resolve(data);
});
})
}
但是收到错误:
Http failure during parsing for http://localhost:4200/assets/data/resource.properties
处理的正确方法是什么?以及如何阅读和添加到模板文件?
有人帮我吗?