Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Bug/feature-request when passing decimal-numbers in strings to number-filters #15137

Open
@filipbech

Description

@filipbech

When you pass a string with a number with decimals to one of the number filters (currency, number) its unclear what happens...

It uses Math.abs() to convert it to a number, which I guess makes sense, but I wish it would do it based on the locale. If you are, like me, are from a country that uses commas as separators you expect the string "4,95" to work, but with math.abs() thats turns into NaN which means nothing shows up.

Possible solutions:

  • have all strings fail the same (skip the Math.abs() call)
  • have all strings work (replace commas with regular dots before math.abs)
  • do it based on settings in ngLocale

I made a plunker, but it only shows that the last number doesn't show up.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions