4
votes

Am trying out Angular-material for the first time and when I tested the mat-select with ngx-translate it did not update the language, not until re-clicking on the input will change take effect.

So does the framework support localization/translation or am I using it wrong

code:

 <mat-form-field>
   <mat-select placeholder="City" [formControl]="city">
      <mat-option *ngFor="let city of cityList" [value]="city.id">
        {{city.name | translate}}
      </mat-option>
  </mat-select>
</mat-form-field>
1
any error you get , i have not used ngx translate but i dnt think it is down to material not supporting it - Rahul Singh
no errors the code works even with normal html its material that is not updating the text when language is switched, I even tried to switch text by using a custom pipe and an object with no ngx-translate, but material just would not update the view not until I click on the input. I think their components don't support async/dynamic input I don't know - ramon22

1 Answers

0
votes

Isn't that because of how Angular handles template expressions?

Angular executes expressions after every change detection cycle. Change detection cycles are triggered by many asynchronous activities such as promise resolutions, http results, timer, keypresses and mouse moves events.

that's why a click triggers the expression where the translate Pipe is executed