Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 我如何格式化这个@pipe货币,并使用角形空格?_Angular - Fatal编程技术网

Angular 我如何格式化这个@pipe货币,并使用角形空格?

Angular 我如何格式化这个@pipe货币,并使用角形空格?,angular,Angular,我的管道当前打印: {{ 200 | currency:'BRL':true }} = R$200.00 我需要包括200.00雷亚尔之间的空间 我会保持正确 {{ 200 | currency:'BRL':true }} = R$ 200.00` 有人能帮我吗?你可以链接一个自定义管道来添加空间 @Pipe({ name: 'space' }) export class SpacePipe implements PipeTransform { transform(value

我的管道当前打印:

{{ 200 | currency:'BRL':true }} = R$200.00
我需要包括200.00雷亚尔之间的空间 我会保持正确

{{ 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

可以链接自定义管道以添加空间

@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

可能重复的重复,我已经解决了它,通过覆盖默认行为可能重复的重复,我有一个解决它通过重写默认行为@ tuijavaDa,请考虑正确的答案,所以我们都可以享受更多的互联网点。@ TuTijavaDa请考虑正确的答案,所以我们都可以享受更多的互联网点。