javascript - Adding a function after completion of ng-hide -
i have tr :
<tr ng-hide="func(item.status)" ng-repeat="item in itemarray" > <td></td> . . </tr>
in func() item.status compared value of dropdown d can changed user @ time.
i have div need show if current number of visible tr == 0. storing number of visible tr
$scope.qvisible = $("#tableid tbody tr:visible").length;
how can have qvisible updated once ng-hide statements have been executed correct result?
i going assume have dropdown somewhere looks like..
<select ng-model="selectedstatus" ng-options="status status in statuses"></select>
so ng-hide can
<tr ng-hide="item.status !== selectedstatus" ng-repeat="item in itemarray" > <td></td> . . </tr>
in controller, need setup watch on selectedstatus..
$scope.qvisible = false; $scope.$watch("selectedstatus",function(newval){ //for loop on items.. counting number of items match selectedstatus // if count 0, set scope variable $scope.qvisible = true; });
in html..
<div ng-show="qvisible">...</div>
this way without touching dom.