Created
June 20, 2020 14:18
-
-
Save Streeterxs/b8d1959043fc432d53a98e360c1ce663 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Pipe, PipeTransform } from '@angular/core'; | |
@Pipe({ | |
name: 'filterNgxMultiselect' | |
}) | |
export class FilterNgxMultiselectPipe implements PipeTransform { | |
transform(arrayNgxMultiselect: {key: string, value: string | number}[], stringToFilter: string): any { | |
return !!arrayNgxMultiselect ? | |
arrayNgxMultiselect.filter(item => `${item.value}`.toLowerCase().trim().includes(stringToFilter.toLowerCase().trim()) || item.key.toLowerCase().trim().includes(stringToFilter.toLowerCase().trim())) : | |
arrayNgxMultiselect; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment