I have this API end-point http://localhost:59253/api/reports?reporttype=evergreen. If I copy this url in the browser it will correctly download the excel file (.xlsx). Now I am trying to call this end-point from my angular service. This is the code in my service.
constructor(private http: Http) { }
getReport() {
return this.http.get('http://localhost:59253/api/reports?reporttype=evergreen')
.map(res => res.totalBytes);
}
And from my component i'm calling the service like this:
submit() {
this.reportService.getReport()
.subscribe(
() => {
console.log("success");
}, err => {
console.log('error');
});
}
In the network tap of browser I can see that I'm hitting the correct Url, yet it doesn't seem to work. No error, It just simply does nothing. Any idea what's happening?