Is there any way to use Angular percent pipe without sign?
Asked Answered
F

1

6

I am trying to format the value with percent pipe in html(Angular2) and i need the percentage value without % sign

Fernyak answered 9/1, 2019 at 7:44 Comment(2)
Multiply with 100, use decimal pipe.Delphine
Did you figure this out? As a clarification, I came across this when I use the percent pipe to format my value in the field. So the "input" is 97 (for 97%) for example. Before sending the value in the pipe, I divide by 100. All displays well. But when I change the value, if I leave the % in the input, out comes the value 96%, and not just 96. As I try to cast to Number in my Typescript, I get problems. I'm looking for a "percent pipe reversal" ?Excommunicatory
C
1

As @Amadan commented in your question, you can use number pipe instead of percent pipe and multiply your value by 100. Like this:

{{ value * 100 | number }}

See this DEMO sample

Cranston answered 10/1, 2019 at 10:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.