I am having a problem when trying to filter an array in angular. I'm using typescript.
I have a parent page that contains a directive. The directive has a property of an Array of items which it displays in a datatable.
On the parent page, I want to filter the list that is being passed to the directive. Here is how I am doing it....
<table items="vm.items"></table>
In my parent controller, I have a button which when you press it executes the following function:
applyFilters() {
var filteredItems=[];
this.items.forEach((value, key) => {
if (value.item!== 'test') {
this.filteredItems.push(value);
}
});
console.log(this.filteredItems);
this.items = this.filteredItems;
}
But the value in the directive does not update when I update the filter?
What am I doing wrong here?
this.filteredItems!=var filteredItems