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

How to dispatch an empty action?

The choosen answer does not work with rxjs6 any more. So here is another approach. Although I prefer filtering for most cases as described in an another answer, using flatMap can sometimes be handy, especially when you are doing complex stuff, too complicated for a filter function: import { Injectable } from ‘@angular/core’; import { … Read more

Change row color in Angular Material table

I assume that you want to apply make-gold class when IsGranted value is true. If this is the case, try this: <mat-row *matRowDef=”let row; columns: displayedColumns;” [ngClass]=”{‘make-gold’: row.IsGranted }”> See also stackblitz demo. EDIT There is also a shorthand syntax: <mat-row … [class.make-gold]=’row.IsGranted’ [class.another-class]=”true”>