数字“管道-角度2"的参数是什么 [英] What are the parameters for the number Pipe - Angular 2
本文介绍了数字“管道-角度2"的参数是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经使用下面的数字管道将数字限制为两位小数.
I have used the number pipe below to limit numbers to two decimal places.
{{ exampleNumber | number : '1.2-2' }}
我想知道'1.2-2'背后的逻辑是什么?我一直在尝试这些方法,以实现过滤到小数点后零位但无济于事的管道.
I was wondering what the logic behind '1.2-2' was? I have played around with these trying to achieve a pipe which filters to zero decimal places but to no avail.
推荐答案
该参数具有以下语法:
{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}
所以您的'1.2-2'
示例意味着:
- 小数点前至少显示一位数字
- 小数点后至少显示两位数字
- 但不能超过2位数字
这篇关于数字“管道-角度2"的参数是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文