Angular 2货币管道格式

标签 angular pipe currency angular2-pipe

现在我有: <span>{{(price | currency: 'EUR': true)}}</span>

这会以标准格式输出 1,000.00

但我需要这种格式1.000,00

最佳答案

在 AppModule 类中更改语言环境。

@NgModule({
  declarations: [
     //
  ],
  imports: [
    //
  ],
  providers: [
    //
  { provide: LOCALE_ID, useValue: "de-DE" }

],
  bootstrap: [AppComponent]
})
export class AppModule { }`

de-DE 只是一个示例,您可以使用任何语言环境。

更多信息在这里 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat#Using_locales

关于Angular 2货币管道格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43894823/

相关文章:

javascript - 使用 Angular 2 下载 Node 流

javascript - 新组件加载 Angular 后焦点不会改变

php - 如何执行MySQL 'SUM'但到 '0'小数位?

css - Uncaught Error : Expected 'styles' to be an array of strings

angular - 如何监视嵌套方法, Jasmine

bash - Shell 已输出但无法通过管道输出数据

currency - 如何在应用程序中计费

Python正则表达式匹配特定货币格式

linux - Linux 管道缓冲区有多少数据? linux 管道缓冲区大小可以配置吗?

bash - 在从管道执行的 bash 脚本中使用 read -p