I use this directive, iterating over an array "myArr", filtering for a few conditions.
<myDirective
myData='item'
ng-repeat="item in filteredArr = (myArr | filter:searchField | filter:checkboxFilter)"
ng-show="$index < visible"
/>
This gives me two issues I'd like to get some input on:
a) the ng-show part is there because I have a condition that handles this:
<p>
<a ng-click='visible=visible+10' ng-show='visible < filteredArr.length'>Show more</a>
</p>
in order to show or hide the "Show more" part. I cannot come up with another idea on toggling this and/or the items itself. $scope.visible is, inside the controller, set to 10, once we start. I couldn't use limitTo as it does not give me the possibility to determine if there's more to show or not, as it of course "chops" the array to the set limit.
b) Inside the directive, the template prints an
<img ng-src="...">
tag. How can I prevent these images to load as long as they're not shown in the above structure?
Thanks a lot in advance!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…