![](/img/trans.png)
[英]How to dynamic translate text file using parameter to the ngx-translate in angular?
[英]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.