2

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.

Kelyane
  • 467
  • 2
  • 7
  • 19

1 Answers1

1

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>
LETOURNEUR Léo
  • 283
  • 3
  • 11