diff options
author | Swapnali Shadanan Pode <sp00501638@techmahindra.com> | 2019-02-19 18:56:25 +0530 |
---|---|---|
committer | Swapnali Shadanan Pode <sp00501638@techmahindra.com> | 2019-02-19 18:56:25 +0530 |
commit | f8bc553eea87191edf2637070c667696dbb60ad0 (patch) | |
tree | 40fcec508a141b11cae289f0f554f12077fd547c | |
parent | 8e1e7f67cb32bc64db45119754eddbfa487d43fd (diff) |
Search pipe
Adding search pipe
Change-Id: I59253eadad17d914e06b5b66d7f01d8c6584388b
Issue-ID: CCSDK-804
Signed-off-by: sp00501638 <sp00501638@techmahindra.com>
-rw-r--r-- | cds-ui/client/src/app/common/shared/pipes/search.pipe.ts | 15 |
1 files changed, 15 insertions, 0 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 new file mode 100644 index 000000000..58b0dc264 --- /dev/null +++ b/cds-ui/client/src/app/common/shared/pipes/search.pipe.ts @@ -0,0 +1,15 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'search' +}) +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); + }); + } +}
\ No newline at end of file |