Created
March 15, 2018 14:08
-
-
Save Mehmet-Erkan/087b6f5f0e004bff22dc73bbf03b4c34 to your computer and use it in GitHub Desktop.
Filter an array by keyword
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
performFilter(filterBy: string) : IProduct[] { | |
filterBy = filterBy.toLocaleLowerCase(); | |
return this.products.filter((product: IProduct) => | |
product.productName.toLocaleLowerCase().indexOf(filterBy) != -1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment