简体   繁体   English

屏蔽 Angular 和 Material UI 的逗号分隔格式的输入货币字段

[英]Mask Input Currency fields with comma separated format for Angular and Material UI

For our Angular 9 application we have currency input fields that need to show a standard masked label with comma separated format.对于我们的 Angular 9 应用程序,我们有货币输入字段,需要以逗号分隔格式显示标准屏蔽 label。

So when the user inputs 56000.55 in the input field then on blur event we should display 56,000.55 as comma separated masked label without changing the original value of the control.因此,当用户在输入字段中输入 56000.55 时,在模糊事件中,我们应该将 56,000.55 显示为逗号分隔的屏蔽 label,而不更改控件的原始值。 We are using Angular Reactive Forms with Mat Form Fields for this UI change.我们正在使用 Angular Reactive Forms 和 Mat 表单字段来进行此 UI 更改。

You just need the number pipe :您只需要编号 pipe

HTML HTML

{{ 56000.55 | number }}
//56,000.55 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM