angularjs - Double loop, display no results if nothing to dispay -
using angularjs, have double loop display data, , filter year.
when, given year, have no results, want display message "no results...", because of double loop, i'm not able work
here demo http://plnkr.co/edit/oswsyxk8bnvmj1rfwhj0?p=preview
the div want display when
<div ng-if="personnes.length < 1" class="noresults">no results</div>
to see example no results, choose "2013-2014" in year dropdown
thanks lot
well, not pretty like, anyways. update html follows:
<div ng-if="filterarray(resultspersonnes).length < 1 && $first" class="noresults">no results</div>
and in controller create new function:
$scope.filterarray = function(resultspersonnes) { return resultspersonnes.filter(function(prop) { return prop.fraiss[0].annee == $scope.annee.id; }); }
so repeats angular in ng-repeat
filters. see updated demo.
Comments
Post a Comment