Angular - change method for mat-select since Angular 6

Revision as of 09:28, 14 September 2020 by Ardaut (talk | changes) (Created page with "Since Angular 6 the change method of mat-select is called "selectionChange" instead of "change".<br> <pre><mat-select (selectionChange)="changeClientLanguage($event.value)">...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Since Angular 6 the change method of mat-select is called "selectionChange" instead of "change".

<mat-select (selectionChange)="changeClientLanguage($event.value)">
  <mat-option *ngFor="let language of languages" [value]="language.code">{{language.name}}</mat-option>
</mat-select>

The method "changeClientLanguage" gets the selected value (which is "language.code").