aboutsummaryrefslogtreecommitdiffstats
path: root/cds-ui/client
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2019-02-19 15:39:16 +0000
committerGerrit Code Review <gerrit@onap.org>2019-02-19 15:39:16 +0000
commitfa9bfa9fdc7e2a1afe09d6bca9106ec9651fb38e (patch)
tree31bcb6a406e0208e12bf66772b1fd6228fd26c01 /cds-ui/client
parent17e9f32b7628addafabe15f30aceab7fba6b18c4 (diff)
parentf8bc553eea87191edf2637070c667696dbb60ad0 (diff)
Merge "Search pipe"
Diffstat (limited to 'cds-ui/client')
-rw-r--r--cds-ui/client/src/app/common/shared/pipes/search.pipe.ts15
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