Angular 2 formatting currency BRL format

前端 未结 11 2418
梦毁少年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:40

    I solved this way:

    app.module.ts

    import { LOCALE_ID } from '@angular/core';
    import localePt from '@angular/common/locales/pt';
    import {registerLocaleData} from '@angular/common';
    registerLocaleData(localePt)
    
     providers: [{
        provide: LOCALE_ID, 
        useValue: "pt-BR"
      }],
    

    .html

    currency:'BRL' 
    

提交回复
热议问题