5

The following bindings:

{{ -50.52338914680037 }}
{{ -50.52338914680037 | number }}
{{ -50.52338914680037 | percent }}

Produce:

-50.52338914680037
-50.523
-5,052.339%

I would anticipate the output of the percent pipe to be

-50.523%

Is there something I'm missing?

1 Answer 1

11

To get your anticipated result of -50.523% use this code:

{{ (-50.52338914680037 / 100) | percent }}

or

{{ -0.5052338914680037 | percent:'2.0-3' }}

Have a look at the DecimalPipe (API) for format adjustments if needed.

2
  • Well that's the default format anyway yeah? At any rate, even with it specified it, I get the same result: -5, 052.339%.
    – user3244479
    Feb 17, 2017 at 20:56
  • 1
    Oh geez...Yep sorry, can't believe I've missed that.
    – user3244479
    Feb 19, 2017 at 19:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy