Currency code with i18N - BRL

Hi,

Im trying to use the pipe to format a currency value.
My format is the BRL (with a value of 1500.50 the format should be R$1.500,50).

Im using the folloing code line to format currency:

<h2>VLF: <b> {{v.VLF | currency:'BRL':true:'1.0-0'}}</b></h2>

What is giving me that result:

image

Should be R$231.682. (period instead of comma).

Any help?
Thanks!

Hi,

Someone knows why the currency code isn’t working properly?

Thanks!

Hello

I have the same issue, did you solve this ?

Hi Fernandoid!

Sorry but I couldnt fixed this so I made my own method to format currency. I can send you the code if you wants.

Marcílio

Hi Marcillioware

I found this solution that you may put in your app.module.ts

import { LOCALE_ID } from '@angular/core';

    providers: [
        { provide: LOCALE_ID, useValue: 'pt-BR' },
2 Likes

Thank you Fernandoid. I’ll try it on my next project!

import { LOCALE_ID } from ‘@angular/core’;

providers: [
    { provide: LOCALE_ID, useValue: 'pt-BR' },

I try this solution, but no success! It’s like ionic don’t use locale configuration from angular when using pipes like currency or date.

Hi!
Im using this configuration as in your code and its working.

{provide: LOCALE_ID, useValue: "pt-BR"}

Use this to format in HTML.

<h4>Value: <strong>{{var.MyValue | currency :'BRL':true:'1.0-0'}}</strong></h4>