Angular 2格式货币BRL格式 [英] Angular 2 formatting currency BRL format

查看:117
本文介绍了Angular 2格式货币BRL格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用管道将商品价格设置为PT-BR货币格式.

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

这是我想做的事情:

<div class="desc">{{statement.price | currency:'BRL':true:'1.2-2'}} </div>  

我期望的结果是33.111,00,现在返回33,111.00.

The result that i expect is 33.111,00 and now is returning 33,111.00 .

推荐答案

您可以设置区域设置ID.导入模块,如下所示:

You can set the locale-id. Import the module as follows:

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

然后在您的模块中定义一个提供程序,如下所示:

And in your module define a provider like this:

providers: [
    {
      provide: LOCALE_ID,
      useValue: "en-US"
    }
]

只需交换您的语言环境ID(有关ID,请参阅 Angular文档).

Just exchange for your locale ID (for IDs, refer to the Angular documentation).

这篇关于Angular 2格式货币BRL格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆