Using AngularJS, I have an input on an HTML form:
<input id="amount" type="number" ng-model="amount">
- I want the user to enter something like: 12.3
- But I want the input to show something like that: 12.30 €
- I want this real-time or on blur.
I also want to keep the possibility to easily perform arithmetic on this input:
<!-- multiply by VAT --> total: {{ amount * 1.015 }}
I already had a look at:
- How to do two-way filtering in angular.js? (filtering the content of the scope, but not the content of the input which exactly the opposite of what I want)
https://docs.angularjs.org/api/ng/filter/currency (not filtering the input, but only the output)
None of those answer my question.
Here is an empty jsfiddle if needed: http://jsfiddle.net/6V7c2/