Angular 2 formatting currency BRL format

前端 未结 11 2479
梦毁少年i
梦毁少年i 2021-02-19 14:52

I\'m trying to use pipe to format the price of an item in PT-BR currency format.

Here what i\'m trying to do:

{{statement
11条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-19 15:43

    For me it worked after importing the locale, as mentioned by Marcelo Vieira das Neves.

    1. Import locale in your module:

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

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

    1. Use the currency pipe

    {{item.limite | currency:'BRL':true}}

提交回复
热议问题