Is there a way to remove the commas when using Currency pipe?
<div>{{balance | currency }}</div>
Output like this - $7,885,412.00
I want like this - $7885412.00
Is there a way to remove the commas when using Currency pipe?
<div>{{balance | currency }}</div>
Output like this - $7,885,412.00
I want like this - $7885412.00
You can use Angular Inbuilt replace
pipe.
<div> {{balance | currency | replace:',':''}}</div>
So, i just made a test app that worked.
generate a pipe using cli, as that will register it for you too with:
ng g p noComma
inside the no-comma.pipe.ts
replace the transform section with:
transform(value: number): string {
if (value !== undefined && value !== null) {
return value.toString().replace(/,/g, '');
} else {
return '';
}
}
then in your view,
{{ balance | currency | noComma }}