What are the parameters for the number Pipe - Angular 2

前端 未结 4 2134
陌清茗
陌清茗 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:18

    1. Regarding your first question.The pipe works as follows:

      numberValue | number: {minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}

      • minIntegerDigits: Minimum number of integer digits to show before decimal point,set to 1by default
      • minFractionDigits: Minimum number of integer digits to show after the decimal point

      • maxFractionDigits: Maximum number of integer digits to show after the decimal point

    2.Regarding your second question, Filter to zero decimal places as follows:

    {{ numberValue | number: '1.0-0' }}
    

    For further reading, checkout the following blog

提交回复
热议问题