search sourecs options issue fixed 14/82014/1
authorSwapnali Shadanan Pode <sp00501638@techmahindra.com>
Tue, 12 Mar 2019 10:26:05 +0000 (15:56 +0530)
committerSwapnali Shadanan Pode <sp00501638@techmahindra.com>
Tue, 12 Mar 2019 10:26:05 +0000 (15:56 +0530)
Change-Id: I828414c8db8299019c073976509e0cd7408916ce
Issue-ID: CCSDK-804
Signed-off-by: sp00501638 <sp00501638@techmahindra.com>
cds-ui/client/src/app/common/shared/pipes/search.pipe.ts

index f5092af..092531e 100644 (file)
@@ -26,12 +26,11 @@ import { Pipe, PipeTransform } from '@angular/core';
 
 export class SearchPipe implements PipeTransform{
    
-    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);
-        });
-    }   
+    transform(item: any, searchText: any): any {
+        if(searchText == null) return item;
+
+        return item.filter(function(search){
+          return search.type.toLowerCase().indexOf(searchText.toLowerCase()) > -1;
+        })
+      }
 }
\ No newline at end of file