title: Angular currency editor
body: <p>I need to make a form control in Angular that supports editing currency values with negative number support and full keyboard support so the user can tab between inputs, type a negative symbol and then enter the value. I have tried ngx-currency, PrimeNG input number and ngx-mask but cannot get exactly what I need.</p>
  <p>Here is a <a href="https://stackblitz.com/edit/angular-ivy-4qccmy?file=src%2Fapp%2Fapp.component.html" rel="nofollow noreferrer">StackBlitz</a> of what I have so far.</p>
  <p>ngx-currency</p>
  <pre class="lang-html prettyprint-override"><code>&lt;input currencyMask [(ngModel)]=&quot;value&quot;&gt;
  </code></pre>
  <p>PrimeNG Input Number</p>
  <pre class="lang-html prettyprint-override"><code>&lt;p-inputNumber [(ngModel)]=&quot;value&quot; mode=&quot;currency&quot;
    currency=&quot;USD&quot; locale=&quot;en-US&quot;&gt;&lt;/p-inputNumber&gt;
  </code></pre>
  <p>ngx-mask</p>
  <pre class="lang-html prettyprint-override"><code>&lt;input [(ngModel)]=&quot;value&quot; mask=&quot;separator&quot; thousandSeparator=&quot;,&quot;
    prefix=&quot;$&quot; [allowNegativeNumbers]=&quot;true&quot;&gt;
  </code></pre>
  <p><em>ngx-currency</em></p>
  <p>you need to type the negative symbol after you have typed the value which is kind of counter intuitive and as soon as you type the negative symbol the cursor goes to the end of the input.</p>
  <p><em>PrimeNG</em></p>
  <p>when you type the negative symbol the next number causes the cursor to jump behind the the cents at the end making it completely unusable.</p>
  <p><em>ngx-mask</em></p>
  <p>It's usable but I can't figure out how to get the cents to always be 2 decimal places and the minus symbol is after the $ symbol instead of before the $. It is the closest as it is usable but the value showing as $50.5 instead of $50.50 will get it rejected by my product owner.</p>
  <p>The control will be used in a spreadsheet style page where tabbing between inputs and entering in the characters -50.50 needs to cause the value to be negative $50 and 50 cents.</p>