I have a server for which I send a request (ID) in response from the server I get a json, inside json i have field ImagePath with url to image. How can I download this picture?
html
<button md-raised-button (click)="DownloadImage(application.ApplicationId)">Download Image</button>
Component
DownloadImage(applicationId:number)
{
var ID=applicationId;
this.httpService.downloadImage(ID).subscribe((response)=>{
console.log(response);
})
}
Service
downloadImage(applicationId:number)
{
return this.http.get('http://192.168.0.138/api/GetPhoto?applicationId='+applicationId,{headers:this.headers})
.map((res:Response)=> res.json() as DownloadImage
);
}
JSON
Object {ImagePath: "http://192.168.0.138:80/Content/photos/29ef5a62-8a84-41cf-92d7-7b76da20357b.jpg"}