【问题标题】:Angular2 using currency in ngModelAngular2在ngModel中使用货币
【发布时间】:2017-06-09 15:14:41
【问题描述】:

您好,我正在尝试使用 Angular2 在输入框中显示货币。现在我有

<p class="list-group-item-text">${{ item.price | number : '1.2-2'}}</p>
<input type="text" class="form-control" [(ngModel)]="item.price">

输出是

我正在寻找的是框内的文本与框上方的文本相同。

【问题讨论】:

标签: html angular


【解决方案1】:

试试这个包:https://www.npmjs.com/package/ng2-currency-mask

添加后,就像在输入中添加 currencyMask 一样简单。

<input currencyMask [(ngModel)]="value" />

【讨论】:

    猜你喜欢
    • 2017-06-22
    • 1970-01-01
    • 2017-07-05
    • 1970-01-01
    • 1970-01-01
    • 2017-11-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多