Angular 2 formatting currency BRL format

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

    in app.module.ts

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

    at the page html {{product.price| currency}}

提交回复
热议问题