0

unable to round percent(%) from 25.46474676% to 25% i am unsing below format Please check

        <text>{{Actual_Val / HighRangeLimit * 100 | percent }}%</text>

Thanks

  • 2
    Does this answer your question? [How can I remove the decimal part from JavaScript number?](https://stackoverflow.com/questions/7641818/how-can-i-remove-the-decimal-part-from-javascript-number) – dota2pro Apr 28 '21 at 08:21
  • Need Angular with HTML code... This like with in SVG – Cric News For Fans Apr 28 '21 at 08:31

2 Answers2

0

You could try to do the calculation inside of ngOnInit and then just set value which you apply the Angular PercentPipe too.

<text>{{ value | percent }}%</text>

value;

ngOnInit() {
this.value = Actual_Val / HighRangeLimit * 100;
}
Filip Huhta
  • 2,043
  • 7
  • 25
0

With the pip percent use : '1.0-0' it will give you 25 instead of 25.46474676

<text>{{Actual_Val / HighRangeLimit * 100 | percent : '1.0-0' }}%</text>

crg
  • 4,284
  • 2
  • 29
  • 57