gpt4 book ai didi

angularjs - 如何根据每条记录的数据动态显示 Angular.js 中的货币?

转载 作者:行者123 更新时间:2023-12-03 02:20:22 25 4
gpt4 key购买 nike

我需要能够动态显示货币及其值(value)。对于固定货币,我能够做到:

<span id="currency-custom">{{amount | currency:'&#8377'}}</span>

但是如果我也想根据服务器传来的货币来更改货币怎么办?在我的 Controller 中,我有:

$scope.longestRide = {
'fromAddress': 'xxx',
'toAddress': 'yyy',
'mycurrency': '&#8377;',
'cost': '238',
'duration': '00:49:02'
}

但这似乎不起作用:

<span id="currency-custom">{{amount | currency:mycurrency}}</span>

如何根据javascript数据结构显示货币?

最佳答案

您应该尝试在 ng-bing-html 中使用过滤器,如下所示:

<span ng-bind-html="amount | currency:mycurrency"></span>

关于angularjs - 如何根据每条记录的数据动态显示 Angular.js 中的货币?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31117205/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com