-
Notifications
You must be signed in to change notification settings - Fork 26.6k
Closed as not planned
Labels
area: commonIssues related to APIs in the @angular/common packageIssues related to APIs in the @angular/common package
Milestone
Description
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
)
Angular: 14.x
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
Metadata
Metadata
Assignees
Labels
area: commonIssues related to APIs in the @angular/common packageIssues related to APIs in the @angular/common package