1

Hello I am trying to show a currency in an input box using Angular2. Right now I have

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

and the out put is

enter image description here

and what I am looking for is the text inside the box to be the same as the text above the box.

Duncan C. Henke
  • 145
  • 1
  • 11
  • This is more of a css issue rather than angular. Check this question: https://stackoverflow.com/questions/2913236/html-text-input-field-with-currency-symbol – AArias Jun 09 '17 at 15:24
  • Check this issue https://stackoverflow.com/questions/40346676/angular-2-using-pipes-with-ngmodel – alehn96 Jun 09 '17 at 16:14

1 Answers1

1

Try this package: https://www.npmjs.com/package/ng2-currency-mask

Once you add this, it is as easy as adding currencyMask to your inputs.

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