Title very much sums up my needs.
123456789 => 123,456,789 12345 => 12,345
What's the best way to get this conversion ? Don't suggest currency pipe in Angular-2 as I don't need $ or currency symbol to be prepend to my output.
Use DecimalPipe like this
{{attr | number}}
Working Plunker
Documentation available at https://angular.io/api/common/DecimalPipe
function printNo() { document.getElementById('text').innerHTML = Number(1234355).toLocaleString('en-GB'); }
<!DOCTYPE html> <html> <head></head> <body onload="printNo()"> <h1 id="text"></h1> </body> </html>
Reference link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With