Show Message if results are empty

I have a search form for products. I would like to make sure that it shows me a message when the list is empty, when there is no result.

My code :

<form ng-controller="productCtrl" name="searchForm" ng-submit="searchProduct()" ng-disabled="searchForm.$invalid">
    <input placeholder="Search" type="text" ng-model="form.name" required>
  <ion-list>
    <ion-item ng-repeat="product in list track by $index">{{ product.name }}</ion-item>
  </ion-list>
</form>

thank you :slight_smile:

Hi Tsila,

You can use ng-if
Canโ€™t test at the moment but something like this

< ng-if="list" ion-item ng-repeat="product in list track by $index">{{ product.name }}</ion-item>
< ng-if="list == false" ion-item>No product(s) found</ion-item>
1 Like