When attempting to filter the month value in a dropdown, I encountered an error stating that indexOf() is not a function. Here is the code snippet:
@Pipe({
name: "monthFilter",
})
export class MonthStatusPipe implements PipeTransform {
transform(array: any[], query: number): any {
console.log("query", query);
if (query) {
return _.filter(array, row => row.LicenseMonth.indexOf(query) > -1);
}
return array;
}
}
Are there any alternative methods to filter dropdowns based on values?
Here is a sample of my JSON data:
{
"BusinessId": 1549,
"OrganizationNumber": "992060867",
"CompanyName": "Litra Containerservice AS ",
"Address": "Industrigata 62",
"Zipcode": "2619 Lillehammer",
"Mobile": "98238925",
"Telephone": "66789485",
"ConnectedTo": "Admin",
"ConnectedToId": "123",
"HSEManager": "Marina Magerøy",
"BusinessContact": "Lars Andre Skogstad",
"ContactMobile": "48499613",
"BusinessContactTelephone": "45283769",
"NoOfEmployees": "15",
"Status": "Active",
"ModifiedOn": "2016-10-01T23:55:01.033",
"LicenseMonth": 10,
"Category": "Godstransport på vei"
},