Struggling to understand this...
In my Angular 2 component, I have a function named filterProducts that is executed whenever a user interacts with a checkbox. Currently, the function identifies all checkboxes marked with a specific class name, retrieves their values, and then tries to organize an array. It seems straightforward...
// Executed when any checkbox is selected or deselected
filterProducts() {
// Retrieve all "Program" checkboxes that are selected
var programsToInclude = $(".programCheckbox:checkbox:checked").map(function () { return this.value; });
// If there are any selected "Program" checkboxes, filter the list accordingly
if (programsToInclude)
this.filteredProducts = this.filteredProducts.filter(x => programsToInclude.indexOf(x.programName) > -1);
}
Why am I encountering this error?
ORIGINAL EXCEPTION: TypeError: programsToInclude.indexOf is not a function
Seems like programsToInclude should be a string array with this function included, right?