Angular 2 - how round calculated number?

后端 未结 3 1872
一个人的身影
一个人的身影 2021-01-12 05:37

I have a *ngFor loop and want to calculate a value - with 2 decimal places.

The calculation works:

3条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-12 06:18

    IF its CURRENCY {{value | currency:'INR':true: '1.0-0'}}

    IF need NUMBER only {{value | number:'1.0-0'}}

    1.0-0 means: at least one digit before decimal point, 0 digits after decimal point.

    https://angular.io/api/common/DecimalPipe

提交回复
热议问题