What are the parameters for the number Pipe - Angular 2

前端 未结 4 2137
陌清茗
陌清茗 2020-12-04 11:39

I have used the number pipe below to limit numbers to two decimal places.

{{ exampleNumber | number : \'1.2-2\' }}

I was wondering what the

4条回答
  •  情歌与酒
    2020-12-04 12:21

    The parameter has this syntax:

    {minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}

    So your example of '1.2-2' means:

    • A minimum of 1 digit will be shown before decimal point
    • It will show at least 2 digits after decimal point
    • But not more than 2 digits

提交回复
热议问题