对ng-repeat值进行ng-Show和ng-Hide除法

时间:2017-11-15 11:02:59

标签: angularjs

<html>
    <span ng-init="hideTableDiv = false;"></span>
    <div ng-repeat="schedule in allschedules" ng-if="(schedule.faculty_id==row.faculty_id) && (schedule.start_time)=='09:30:00'">
       <span ng-init="hideTableDiv = true;"></span>
       <span id="{{schedule.schedule_id}}" style="font-size: 88%">   

           <span class="label spanlabel" style="font-weight:100">{{schedule.classroom}}&nbsp;{{schedule.module_name}}&nbsp;{{schedule.cohort_name}}</span>
           <a id="delete_0-{{$index}}" class="" ng-click="deleteschedule(schedule.start_time,schedule.module_id,schedule.schedule_id);"><i class="fa fa-trash-o" style="color:red"></i></a>           

       </span>      
   </div>
   <div ng-if="!hideTableDiv">ALL DROPDOWN BOXES</div>
</html>

我正在研究的代码一瞥。需要检查labeldiv是否显示隐藏表格div,反之亦然。

如何实现?

2 个答案:

答案 0 :(得分:1)

这样做:

<html>
<span ng-init="hideTableDiv = false;"></span>
<div id="labeldiv" ng-repeat="schedules in allschedules" ng-if="schedules.facultyis==row.facultyid">
<span ng-init="hideTableDiv = true;"></span>
<span>id Matches</span>
</div>

<div id="tablediv"  ng-if="!hideTableDiv">
</div>
</html>

答案 1 :(得分:0)

检查数组是否为空

<html>
<div id="labeldiv" ng-repeat="schedules in allschedules" ng-if="schedules.facultyis==row.facultyid">
<span>id Matches</span>
</div>

<div id="tablediv" ng-if="allschedules.length > 0">
</div>
</html>