Guest User

Untitled

a guest
May 24th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. @Pipe({
  2. name: 'filter'
  3. })
  4. export class FilterPipe implements PipeTransform {
  5. debuger;
  6. transform(items: any[], searchText: string): any[] {
  7. if(!items) return [];
  8. if(!searchText) return items;
  9. searchText = searchText.toLowerCase();
  10. return items.filter( it => {
  11. return it.toLowerCase().includes(searchText);
  12. });
  13. }
  14. }
  15.  
  16. <input [(ngModel)]="searchText" placeholder="enter search term here">
  17. <table class="table table-sm">
  18. <thead>
  19. <tr>
  20. <th>Auction ID</th>
  21. <th>Auction Name</th>
  22. </thead>
  23. <tbody>
  24.  
  25. <tr *ngFor="let value of auction?.data | filter :searchText">
  26. <tr>
  27. <th>Auction ID</th>
  28. <th>Auction Name</th>
  29. <tr/>
Add Comment
Please, Sign In to add comment