Nativescript连接文本使用Label

时间:2016-05-28 04:42:27

标签: javascript android mobile nativescript

我想在Label中组合字符串。我想要的结果是:3000美元,数据库价格3000。所以我使用代码:

USD {{ price }}

但没有工作,并显示如下:

get-in

我可以直接连接文本标签中的字符串吗?或任何关于此的线索。 不管怎样,谢谢

2 个答案:

答案 0 :(得分:7)

我认为应该是这样的:

<Label text="{{ 'USD' + price }}" />

答案 1 :(得分:4)

Nativescript Angular格式如下:

 <Label [text]="'Amount: ' + item.Gross"></Label>

或使用管道来表示货币:

<Label [text]="item.Gross | currency:'USD':true" ></Label>