gpt4 book ai didi

angular - 我如何用 Angular 空间格式化这个@pipe货币?

转载 作者:行者123 更新时间:2023-12-03 09:04:13 24 4
gpt4 key购买 nike

我的管道当前打印:

{{ 200 | currency:'BRL':true }} = R$200.00

我需要在 200.00 中的 R$ 之间包含空格会保持正确

{{ 200 | currency:'BRL':true }} = R$ 200.00`

有人可以帮助我吗?

最佳答案

您可以链接自定义管道来添加空格

@Pipe({
name: 'space'
})
export class SpacePipe implements PipeTransform {
transform(value: any, args?: any): any {
return value.replace('R$', 'R$ ');
}
}

{{ 200 | currency:'BRL':true | space }} // R$ 200.00

关于angular - 我如何用 Angular 空间格式化这个@pipe货币?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48306585/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com