Which @angular/* package(s) are the source of the bug?
common
Is this a regression?
No
Description
I have used number pipe for show list of numbers, but I have got a persian/farsi number like '۲۰' alongside other items in my data and got an error with type 'InvalidPipeArgument'.
Is there a way to manage this non-english numbers?
I would not convert data before binding.
Please provide a link to a minimal reproduction of the bug
https://stackblitz.com/edit/angular-ivy-n1wrjy
Please provide the exception or error you saw
ERROR
Error: NG02100: InvalidPipeArgument: '۲۰ is not a number' for pipe 'DecimalPipe'
Please provide the environment you discovered this bug in (run ng version)
Anything else?
update: I've solved this problem by add a function to my component:
transformNonNumber(number: string): string {
const persianNumbers = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'];
for (var i = 0; i < 10; i++) {
let reg = new RegExp(persianNumbers[i], "g");
number = number.replace(re, i.toString());
}
return number;
}
Please add this method to number pipe for easier using in future. Thanks
Which @angular/* package(s) are the source of the bug?
common
Is this a regression?
No
Description
I have used number pipe for show list of numbers, but I have got a persian/farsi number like '۲۰' alongside other items in my data and got an error with type 'InvalidPipeArgument'.
Is there a way to manage this non-english numbers?
I would not convert data before binding.
Please provide a link to a minimal reproduction of the bug
https://stackblitz.com/edit/angular-ivy-n1wrjy
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run
ng version)Anything else?
update: I've solved this problem by add a function to my component:
Please add this method to number pipe for easier using in future. Thanks