簡體   English   中英

如何使用 ngx translate to angular 將數據轉換為 ts

[英]How to translate data to ts using ngx translate to angular

組件.ts

我在 app.component.ts 中有這段代碼,需要將其轉換為 select 選項

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

組件.html

html 使用 ng For

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

使用pipe在模板中翻譯它。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM