angularjs - ng hide/show based on list values -
i need hide "current insurance cover" when coveramt of covers in list 0 or negative value. if 1 coveramt in list positive value need show "current insurance cover" once.
i tried this, no luck..!
<li ng-repeat="cover in accsummary.response.covers"> <div class="account-detail-row col-xs-12 col-sm-12 col-md-12 padding-left12 padding-right12 padding-top24 padding-bottom12"> <h4 class="font-16 fontwt-400" ng-hide="cover.coveramt <= 0">current insurance cover</h4> </div> </li>
can please me on this..! thanks.
you have calculate in controller below:
app.controller("cover", function($scope){ $scope.covers = [{coveramt: 10},{coveramt: 0},{coveramt: -1}]; $scope.showheading = function(){ var flag = false; for(var i=0; i<$scope.covers.length; i++) { if($scope.covers[i].coveramount > 0) { flag = true; break; } } return flag; }; });
html be
<h4 class="font-16 fontwt-400" ng-show="showheading();">current insurance cover</h4>
Comments
Post a Comment