aboutsummaryrefslogtreecommitdiffstats
path: root/cds-ui/client/src/app
diff options
context:
space:
mode:
authorSwapnali Shadanan Pode <sp00501638@techmahindra.com>2019-03-20 13:33:40 +0530
committerSwapnali Shadanan Pode <sp00501638@techmahindra.com>2019-03-20 13:33:40 +0530
commit02168b46d5614325afc1c5c6165b0bda3279e251 (patch)
treed720ff98cffa4767dbd56e3fb492ad4173f979a8 /cds-ui/client/src/app
parent3e9c1231dd509953130dfbeb3ddd46bbe53b2629 (diff)
Search pipe
Change-Id: I12067ff7e9e7a8aac1ea11328e8d0da08cb791f2 Issue-ID: CCSDK-804 Signed-off-by: sp00501638 <sp00501638@techmahindra.com>
Diffstat (limited to 'cds-ui/client/src/app')
-rw-r--r--cds-ui/client/src/app/common/shared/pipes/search.pipe.ts15
1 files changed, 8 insertions, 7 deletions
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 092531ee3..b0d37c3d1 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 @@ import { Pipe, PipeTransform } from '@angular/core';
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