diff options
Diffstat (limited to 'cds-ui/client/src')
-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 |