<div>
<h1>Birds</h1>
<ul>
<li ng-if="bird.type === 'bird'"
ng-repeat="bird in creatures">{{bird.name}}</li>
</ul>
</div>
I received data from the server and I need to display it in the list. However, if the list is empty, I want to hide the entire div container. For instance, if bird.type === 'bird'
is not present in the array, I want the div to be hidden. I can't use ng-if="bird.type === 'bird'"
directly on the div
because I need to access the bird object after the ng-repeat. Is there a way to check if the li is empty and then hide the div?
AngularJS ng-repeat handle empty list case - Although similar, this is not exactly what I am looking for. I don't want to hide the li if it's empty, but rather hide the parent div that contains the h1 when the li is empty.