Hi, how can i change “.” for “,” in my ionic ex: R$ 1.500,00
I try change {provide: LOCALE_ID, useValue: ‘pt-BR’}
detalhes.module.ts
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { DetalhesPage } from './detalhes';
import { LOCALE_ID } from '@angular/core';
import { Pipe, PipeTransform } from '@angular/core';
import { CurrencyPipe } from '@angular/common';
@Pipe({
name: 'currencyFormat'
})
export class CurrencyFormatPipe implements PipeTransform {
transform(value: number, locale: string, currency_symbol: boolean, number_format: string = '1.2-2'): string {
if (value) {
let currencyPipe = new CurrencyPipe('pt-BR');
let new_value: string;
new_value = currencyPipe.transform(value, locale, currency_symbol, number_format);
if (locale = 'BRL') {
new_value = new_value.replace('.', '|').replace(',', '.').replace('|', ',');
}
return new_value
}
}
}
@NgModule({
declarations: [
DetalhesPage,
],
imports: [
IonicPageModule.forChild(DetalhesPage),
],
providers: [
{provide: LOCALE_ID, useValue: 'pt-BR'}
]
})
export class DetalhesPageModule {}
<p>{{ item.valor | currency}}</p>
<p>{{ teste | currency:"BRL"}}</p>