Home > Mobile >  ngx-translate set of values in for loop
ngx-translate set of values in for loop

Time:12-23

I've got this for loop in my .html file

<div >
<mat-grid-list cols="4" rowHeight="200px">
    <mat-grid-tile *ngFor="let item of gridItems; index as i;" [colspan]="item.colSpan" [rowspan]="item.rowSpan">
        <a *appShowWithPermission="item.permissions" [routerLink]="item.route" >
            <mat-icon>{{item.icon}}</mat-icon>
            {{item.name}}
        </a>
    </mat-grid-tile>
</mat-grid-list>

'gridItems' always got the same 4 item names. How can I translate them with my ngx-translate?

CodePudding user response:

by using pipe:

{{item.name | translate }}
  • Related