繁体   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