Skip to main content
added 104 characters in body
Source Link
Tim B
  • 2.4k
  • 15
  • 21

Assign the output of the filter to a variable, and then hide the header based on the length of that.

<div ng-repeat="Cat in info" ng-hide="filtered.length == 0"> <h3>{{Cat.name}}</h3> <ul> <li ng-repeat="Item in filtered = (Cat.data | filter:search)" > {{Item.name}} </li> </ul> </div> 
<div ng-repeat="Cat in info" ng-hide="filtered.length == 0"> <h3>{{Cat.name}}</h3> <ul> <li ng-repeat="Item in filtered = (Cat.data | filter:search)" > {{Item.name}} </li> </ul> </div> 

Assign the output of the filter to a variable, and then hide the header based on the length of that.

<div ng-repeat="Cat in info" ng-hide="filtered.length == 0"> <h3>{{Cat.name}}</h3> <ul> <li ng-repeat="Item in filtered = (Cat.data | filter:search)" > {{Item.name}} </li> </ul> </div> 
Source Link
Tim B
  • 2.4k
  • 15
  • 21

<div ng-repeat="Cat in info" ng-hide="filtered.length == 0"> <h3>{{Cat.name}}</h3> <ul> <li ng-repeat="Item in filtered = (Cat.data | filter:search)" > {{Item.name}} </li> </ul> </div>