I asked this question earlier, but I think perhaps I worded it incorrectly and the answers that I got was how to show/hide a set of divs upon the click of a button. I understand how that can be done. However my problem is a bit different. I am trying to post a more elaborate and detailed question this time:
I have a bunch of divs that show images
<div ng-controller='PhotoController'>
<button>SHOW ALL</button>
<button>SHOW FILTERED</button>
<div ng-repeat="photo in photos" ng-show='isShowImage' class='image-container'>
<img ng-src ='{{photo.src}}' data-show='{{photo.filtered}}'>
<br/>
</div>
</div>
The value for {{photo.filtered}}
comes from database and will be an integer. What I want is that when SHOW FILTERED button is clicked, only those divs with class as image-containers
should be shown which has an image inside it for which the data-show
attributed will be non-zero.
Upon clicking SHOW ALL, all the photos will be shown irrespective of data-show
value.
I know that if I add ng-show={{photo.filtered}}
to the image-container
div then I can show only the images which have data-show as non-zero. However I do not know how to change this criteria when SHOW ALL is clicked.
Any insight is appreciated.