I have an array that always returns 20 items. However, if fewer than 20 items are returned, a " " is returned rather than reducing the number in the array.
For example, myArray
with 20 items (only 15 values).
$scope.myArray = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", " ", " ", " ", " ", " "]
I want to perform an ng-show/hide/if on some elements depending on the number of populated in the items in myArray.
Originally I tried:
<div ng-show="myArray.length > 10">
Show if more than 10 items
</div>
<div ng-show="myArray.length > 15">
Show if more than 15 items
</div>
<div ng-show="myArray.length > 19">
Show if more than 19 items
</div>
Naturally, all of the above will show as there are always 20 items returned.
Can I achieve this with an ng-show/hide/if and without having to write additional JS in my controller?