Nauryz Utepov
Nauryz Utepov

Reputation: 11

How to translate data to ts using ngx translate to angular

component.ts

I have this code in app.component.ts and it needs to be translated to select option

label = ['', 'label1', 'label2']

component.html

html uses ng For

<select>
   <option *ngFor="let value of label">{{value}}</option>
</select>

Upvotes: 0

Views: 76

Answers (1)

Daniel B
Daniel B

Reputation: 8879

Use the pipe to translate it in the template.

<select>
   <option *ngFor="let value of label">{{value | translate}}</option>
</select>

Upvotes: 1

Related Questions