Search pipe
Change-Id: I12067ff7e9e7a8aac1ea11328e8d0da08cb791f2
Issue-ID: CCSDK-804
Signed-off-by: sp00501638 <sp00501638@techmahindra.com>
diff --git a/cds-ui/client/src/app/common/shared/pipes/search.pipe.ts b/cds-ui/client/src/app/common/shared/pipes/search.pipe.ts
index 092531e..b0d37c3 100644
--- a/cds-ui/client/src/app/common/shared/pipes/search.pipe.ts
+++ b/cds-ui/client/src/app/common/shared/pipes/search.pipe.ts
@@ -26,11 +26,12 @@
export class SearchPipe implements PipeTransform{
- transform(item: any, searchText: any): any {
- if(searchText == null) return item;
-
- return item.filter(function(search){
- return search.type.toLowerCase().indexOf(searchText.toLowerCase()) > -1;
- })
- }
+ transform(items: any[], searchText: string): any[] {
+ if(!items) return [];
+ if(!searchText) return items;
+ searchText = searchText.toLowerCase();
+ return items.filter( it => {
+ return it.toLowerCase().includes(searchText);
+ });
+ }
}
\ No newline at end of file