Vijay
Vijay

Reputation: 596

Filter pipe throwing errors for table data

I am trying to implement a search pipe for a data set with mixed values of string, number and boolean. I am trying to implement the following pipe Demo, The link works great with a dataset with strings but I keep getting the error that toUpperCase() is not a function because it is unable to iterate through the data with different data types, please suggest me a way around. I have tried modifying the link in many ways but I am failing. My Data set is as follows{ "pnr_id": 5037295, "uniqueId": 103739, "amount_paid": 37.2484, "name": "Sharon", "surname": "Monroe", "fullname": "Rhonda McLean", "email": "[email protected]", "amount_due": true, "amount_pending": 13.258, "user_name": "[email protected]" }, { "pnr_id": 5037296, "uniqueId": 195415, "amount_paid": 42.7672, "name": "Don", "surname": "Goldstein", "fullname": "Christina Carroll", "email": "[email protected]", "amount_due": true, "amount_pending": 35.9709, "user_name": "[email protected]" } Thank you and regards

working Plunkr link for data set with Strings:-- https://plnkr.co/edit/jXfqfCuJpKdw9HtL569T?p=preview

Upvotes: 0

Views: 41

Answers (1)

Pengyy
Pengyy

Reputation: 38189

As you posted, toUppercase is a prototype function for string, when you call it directly from type out of string, this error will happen.

you can use toString() to convert number/decimal to string.

see the working plunker.

Upvotes: 1

Related Questions