angular-filter icon indicating copy to clipboard operation
angular-filter copied to clipboard

Add a "digit" filter

Open kechol opened this issue 10 years ago • 2 comments

How about to having a filter to convert number-like-string to digits? Angular supports "number" filter to format numbers with fraction. Maybe it is good to have a filter for opposite conversion.

{{"1,234,567"|digit}} // get 1234567

If you like it, I can send you a PR. Thanks.

kechol avatar Nov 05 '15 10:11 kechol

A "digit" and "float" filter would be beneficial and simple to implement. Using a filter is a more elegant way opposed to exposing a parseInt/parseFloat function to scope. The concrete example I ran across was in using input[type=range] which returns a string instead of a number, where my model needed a number.

trodi avatar Jun 07 '16 23:06 trodi

An interesting issue is that

{{ ["0", "0.5", "1.5", "2.5"] | map:parseFloat }} // should get [0, 0.5, 1.5, 2.5]

doesn't work.

stlyx avatar Nov 14 '16 10:11 stlyx