I want to filter out object data based on value from an array. The below snippet work fine when no null value, but in case of null value in column it's not working.
Here is StackBlitz
filter() { this.dataSource.data = ELEMENT_DATA.filter(({ name }) => this.filterArray.some(n => name.toLowerCase().includes(n.toLowerCase())) ); }
filter() { this.dataSource.data = ELEMENT_DATA.filter(({ name }) => this.filterArray.some(n => name ? name.toLowerCase().includes(n.toLowerCase()) : "") ); }
2.1m questions
2.1m answers
60 comments
57.0k users