【问题标题】:Adding the AngularJS Currency Locale to the end将 AngularJS 货币语言环境添加到末尾
【发布时间】:2016-04-04 16:09:23
【问题描述】:

我有以下标记:

<div class="full">
    <dl class="no-margin">
        <dt ng-if="foo.IsLoading" class="no-margin text--plain">
        <img alt="Load animation" src="load_small.gif"/> Loading
        </dt>
        <dt ng-if="!foo.IsLoading" class="no-margin text--plain">{{foo.BalanceLabel}}</dt>
        <dd class="h3 text--plain" ng-class="{' text--negative': model.IsNegativeBalance(foo.BalanceValue)}">{{foo.BalanceValue | currency:"CAD"}}</dd>
    </dl>
</div>                 

唯一的问题是它将 3 位数的值添加到值的开头:“CAD1,234.56”或“-CAD1,234.56”

这对美元来说很好,因为我们希望前面有美元。但是,我的设计要求金额的末尾要外加 3 位数字:“1,234.56 CAD”或“-1,234.56 CAD”

我仍然可以使用 Angular 货币 API 来完成此操作吗?

【问题讨论】:

    标签: javascript angularjs html


    【解决方案1】:

    您无法使用货币过滤器来解决它。 您有两种选择可以解决您的问题。

    修复 1:

    使用 i18n 角度(例如 de)

    <script src="i18n/angular-locale_de-de.js"></script>
    

    修复 2:

    使用不带货币过滤器的货币过滤器编号

    {{foo.BalanceValue | number:2}}CAD
    

    对于 Fix 1,我不确定是否使用货币 CAD。我只尝试使用 €。

    【讨论】:

      猜你喜欢
      • 2012-09-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多