In Angular 2+ how do you detect that a filter/pipes returned no results

0
435

Hope you first follow this link Create filter search using custom Pipe. Then if now you want to show that search results are not found then follow the below code.

<ng-container *ngIf=”(items | filter:search.value) as result”>

  <div *ngFor=”let item of result”>
    {{item}}
  </div>

  <p>Count: <b>{{result.length}}</b></p>

</ng-container>

LEAVE A REPLY

Please enter your comment!
Please enter your name here