molerat molerat - 1 year ago 120
AngularJS Question

AngularJS number filter greater than 1000

In Angular I have this line

<input type="number" value="{{ price.fare + | number:2 }}" />

But as soon as
add up to
, I get this error:

The specified value "1,000.00" is not a valid number. The value must match to the following regular expression: -?(\d+|\d+\.\d+|\.\d+)([eE][-+]?\d+)?

How can I fix this?

Answer Source

Remove type=number in total column. Plunker here -

  <div ng-controller="myController as price">
      <h1>AngularJS number filter greater than 1000</h1>
      <a href="">Stack Overflow </a>
      Fare: <input type="number" ng-model="price.fare" />
      Tax: <input type="number" ng-model="" />
      Total: <input value="{{ price.fare + | number:2 }}" />


myApp.controller('myController', function($scope) {
  this.fare = 990; = 20;