I think that there are two ways to resolve this problem:
1. You can trying overwrite DecimalPipe from @angular/common library:
In this way:
point-replacer.pipe.ts
import { Pipe } from '@angular/core';
import {DecimalPipe} from "@angular/common";
@Pipe({
name: 'pointReplacer'
})
export class PointReplacerPipe extends DecimalPipe {
transform(value: any, digits?: string): string {
return super.transform(value, digits).replace(',', '.');
}
}
and in your html code:
<div padding *ngIf="TotalAPagar">
$ {{TotalAPagar | pointReplacer }}
</div>
2. You can write your own pipe, which replaces characters and use **double pipe in your html code**
Try in this way:
point-replacer.pipe.ts
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'pointReplacer'
})
export class PointReplacerPipe implements PipeTransform {
transform(value: string, args: any[]): string {
if(value) {
return value.replace(',', '.');
}
return '';
}
}
and in your html code:
<div padding *ngIf="TotalAPagar">
$ {{TotalAPagar | number | pointReplacer }}
</div>
No matter which method you choose, don't forget to declare your own pipe in module, where you use it:
@NgModule({
declarations: [PointReplacerPipe],
providers: [PointReplacerPipe]
})