Hi Folks,
I am using Asp.net Core and Angular 2/4
In Asp.net:
[HttpGet("GetDownload/{id}")]
public FileResult Download([FromRoute] int id)
{
var getFile = _context.UploadPoliceReports.FirstOrDefault(m => m.
UploadPoliceReportID == id);
MemoryStream ms = new MemoryStream(getFile.Data);
return File(ms, getFile.ContentType, getFile.FileName);
}
Well, I run "http://localhost:5001/...../getDownloadPolice/43" to a direct
download image file and seem GOOD!
Now...
In Service:
getDownloadPolice(id: number) {
//return this.http.get(this.downloadPoliceUrl + '/' + id, {
responseType: ResponseContentType.Blob })
return this.http.get(this.downloadPoliceUrl + '/' + id)
.map((data: Response) => {
<<<??????>>>
//return data;
//return new Blob([data.blob()], { type: data.blob().type });
})
.do(data => console.log(data));
}
In Component:
getDownload() {
this.userFormVehicleService.getDownloadPolice(43).subscribe(data => {
<<<??????>>>
});
}
I have no idea what i should write down the code in Service and Component.
Any Idea?
I am waiting for your response.
Thanks in Advance
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.