I have a simple ng-repeat that displays only half of the items. For some reason, i got it to work with ng-show but not with ng-if. I don't understand why?
this works:
<li ng-repeat="item in items" ng-show="$index < items.length / 2">{{item}}</li>
this doesn't:
<li ng-repeat="item in items" ng-if="$index < items.length / 2">{{item}}</li>
here is a jsfiddle to demonstrate: http://jsfiddle.net/HB7LU/17269/
This question: AngularJS: ng-if not working in combination with ng-click? does not provide an answer why ng-show works while ng-if doesn't
` is not valid child of `
`
– charlietfl Sep 05 '15 at 20:08