A spreadsheet-like functionality where the value in a number input is formatted (e.g. 1,000,000, $50.00, 50%), but only when the input is not focused - once the user begins editing the number, it becomes 1000000, 50 etc.
Here is an example http://jsfiddle.net/LCZfd/8/ (taken from http://stackoverflow.com/a/24057713) that keeps the advantages of type="number", except for displaying the small up/down arrows when the input is not focused (Firefox/Safari do this always, Chrome only on hover).
@EladBezalel Is this feature really desired? In general I can't find anything in the specs about that.
1+
+1
ended using ng-currency, no need to reopen
@ejohnsonw are you using this library:
https://github.com/aguirrel/ng-currency
Why closed? Because ng-currency exists? eyeroll
Just add another input attribute to format the displayed value. e.g. a display-function. And this should be called every time the value is really updated. Not from user only. input and change event is not enough. You have to handle it, when another element change the value and both shared the value over ngModel.
Just looking for a fast clean solution to display the input type="number" value with fixed decimal places.
In a display function you can do anything you want. Like divide with 1000 and toFixed(2), etc.
Or simply add a option with a format string like "0.00" (excel like)
Most helpful comment
ended using ng-currency, no need to reopen