2

How can I separate this number 1234567890' to1,234,567,890` with using pipe Angular ?
I try it by this code but show me: 1,234,567,890,000

{{ item.price | number:'3.3' }}

3 Answers 3

4

Use it this way:

{{ item.price | number: '3.' }}

This will remove the digits after decimal.

1
  • It's work thanks, but when I remove : '3.' and then works Jul 14, 2018 at 10:06
2

In order to get rid of the extra 0's and to produce 1,234,567,890 Use the following pipe:

{{ item.price | number: '3.'}}

output:

1 234 567 890
1

The correct format is to set 3.0-0 to remove the digits after decimal.

{{31544543.512 | number :'3.0-0'}} // => 31,544,544

Check the sample section at DecimalPipe

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.