How to receive blob responses using Angular’s 2+ @angular/http module?
With the release of Angular2 final we can define for example a service: @Injectable() export class AngularService { constructor(private http: Http) {} download(model: MyModel) { //get file from service this.http.post(“http://localhost/a2/pdf.php”, JSON.stringify(model), { method: RequestMethod.Post, responseType: ResponseContentType.Blob, headers: new Headers({‘Content-Type’, ‘application/x-www-form-urlencoded’}) }).subscribe( response => { // download file var blob = new Blob([response.blob()], {type: ‘application/pdf’}); var … Read more