0
我得到一個串響應如下:打字稿提取部分來處理進一步
{'url': <ImageFieldFile: photologue/photos/spiderman.png>}{'url': <ImageFieldFile: photologue/photos/superman_PucGOkm.jpg>}
我只需要photologue /照片/ spiderman.png和photologue /照片/ superman_PucGOkm。 JPG從這個來構建具體的網址,像以下:
http://127.0.0.1:8000/media/photologue/photos/spiderman.png
我該如何在打字稿中做到這一點? 我angular2部件功能:
fetchGallery(id: number){
this.showImages=true;
this.galleryService.fetchGallery(id)
.then(
response => {
this.gallery = response;
console.log(typeof(this.gallery._body))
});
}
是的這看起來是正確的,但也可能有.jpg圖像,你可以在返回的字符串中看到。所以我需要以某種方式同時提取兩者。 – Nitish
我已更新答案,現在任何文件擴展名將被提取 – mitch
它仍然以某種方式給我只有一個字符串而不是兩個 – Nitish