angularjs - Parse amount in input in Javascript -


i have input in form user have write amount pay. problem user have different ways it, 1,350.55 (this correct one), 1.350,55 or 1.350. so, there way parse amount correct form?

thanks!

you want parse input, right? why not try make input currency field? , parse container through angular, customers may see value , work angular filtered value.

here fiddle: http://jsfiddle.net/lacrioque/voulmrac/

<p><label for='numberinput'>your price here: </label><input type='number' name='numberinput' ng-model='numbertofilter' placeholder="1,350.99"/></p> <p>price: <span>{{numbertofilter | currency }}</span></p> 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -