Reputation: 467
I already tried to use <span>{{(price | currency: 'EUR': true)}}</span>
and { provide: LOCALE_ID, useValue: "de-DE" }
. However, server environment is based in USA and I can't change language location there.
Then the standard format is $1,000.00, but I need this format 1.000,00 €
Thank you.
Upvotes: 2
Views: 1452
Reputation: 311
You can try this (a little bit tricky) :
Declare your custom pipe, it will replace ',' buy '.' and '.' by ',' :
@Pipe({ name: 'customPipe' })
export class ToCustomPipe implements PipeTransform {
transform(value: string):any {
if(value == null) return '';
value = value.toString().replace(/,/, "*");
value = value.toString().replace(/./, ",");
value = value.toString().replace(/*/, ".");
return value;
}
}
then in your html :
<span>{{(price | currency:'USD':false | customPipe)}} €</span>
Upvotes: 1