[英]Limit to 2 decimal places for a number like (25) with angular percentage pipe
I want to convert number to percentage format like 25 to 25.00% with angular percentage pipe.I have used this one.我想将数字转换为百分比格式,如 25 到 25.00% 和 angular 百分比 pipe。我用过这个。
{{ number | percent : '0.2-2'}}
I am getting like this 2,500.00%.any one can help me with this?我变得像这样 2,500.00%。任何人都可以帮助我吗?
Probably you're using it with a big number, check this example on stackblitz.可能您正在大量使用它,请在 stackblitz 上查看此示例。 Remember that
1
equals 100%
, so to show 25%
, you need to put 0.25
请记住
1
等于100%
,因此要显示25%
,您需要输入0.25
Also, check the docs and their examples, should be doubtless另外,检查文档和他们的例子,应该是毫无疑问的
https://stackblitz.com/edit/angular-ivy-iszurj?file=src%2Fapp%2Fapp.component.html https://stackblitz.com/edit/angular-ivy-iszurj?file=src%2Fapp%2Fapp.component.html
https://angular.io/api/common/PercentPipe https://angular.io/api/common/PercentPipe
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.