Javascript 如何使用Angular.js在ng repeat中检查数组值是否为null

Javascript 如何使用Angular.js在ng repeat中检查数组值是否为null,javascript,arrays,angularjs,angularjs-ng-repeat,Javascript,Arrays,Angularjs,Angularjs Ng Repeat,我需要一个帮助。我需要检查数组是否没有值,并使用Angular.js在那里显示一条消息。我在下面解释我的代码 <table class="table table-bordered table-striped table-hover" id="dataTable"> <thead> <tr> <th>Sl. No</th> <th>Date</th> <th> Info(Academic Yea

我需要一个帮助。我需要检查数组是否没有值,并使用Angular.js在那里显示一条消息。我在下面解释我的代码

  <table class="table table-bordered table-striped table-hover" id="dataTable">

<thead>
<tr>
<th>Sl. No</th>

<th>Date</th>
<th>
Info(Academic Year,Section,Subject,Semester)
</th>
<th>
Unit Name
</th>
<th>
Lecture Plan
 </th>
<th>Action</th>
</tr>
</thead>
<div ng-if="viewIncompletePlanData.length>0">
<tbody id="detailsstockid">
<tr ng-repeat="p in viewIncompletePlanData">
<td>{{$index+1}}</td>

<td>{{p.date}}</td>
<td>{{p.session}},{{p.section_name}},{{p.subject_name}},{{p.semester}}</td>
<td>{{p.unit_name}}</td>
<td>{{p.plan}}</td>
<td> 
<a >
<input type='button' class='btn btn-xs btn-success' value='Update' ng-click="">  
</a>
</td>
</tr>   
</tbody>
</div>
<div ng-if="viewIncompletePlanData.length==0">
<tr>
<center><p><b>No Record Matched</b></p></center>
</tr>
 </div>
</table>

序号
日期
信息(学年、部门、科目、学期)
单位名称
教学计划
行动
{{$index+1}}
{{p.date}}
{{p.session}}、{p.section{u name}、{{p.subject{u name}、{p.sement}
{{p.unit_name}
{{p.plan}
没有匹配的记录

在上面的代码中,我需要当
查看不完整的计划数据
没有值时,它将在那里显示消息
未找到记录
,否则显示数组结果。请帮助我。

您可以通过/来完成此操作

像这样试试

<table class="table table-bordered table-striped table-hover" id="dataTable">
   <thead>
      <tr>
         <th>Sl. No</th>
         <th>Date</th>
         <th>Info(Academic Year,Section,Subject,Semester)</th>
         <th>Unit Name</th>
         <th>Lecture Plan</th>
         <th>Action</th>
      </tr>
   </thead>
   <tbody id="detailsstockid">
      <tr ng-repeat="p in viewIncompletePlanData" ng-if="viewIncompletePlanData.length>0">
         <td>{{$index+1}}</td>
         <td>{{p.date}}</td>
         <td>{{p.session}},{{p.section_name}},{{p.subject_name}},{{p.semester}}</td>
         <td>{{p.unit_name}}</td>
         <td>{{p.plan}}</td>
         <td>
            <a>
            <input type='button' class='btn btn-xs btn-success' value='Update' ng-click="">  
            </a>
         </td>
      </tr>
      <tr ng-if="viewIncompletePlanData.length==0">
         <td colspan="6">
            <center>
               <p><b>No Record Matched</b>
               </p>
            </center>
         </td>
      </tr>
   </tbody>
</table>

序号
日期
信息(学年、部门、科目、学期)
单位名称
教学计划
行动
{{$index+1}}
{{p.date}}
{{p.session}}、{p.section{u name}、{{p.subject{u name}、{p.sement}
{{p.unit_name}
{{p.plan}
没有匹配的记录


您可以检查阵列的长度。如果
长度>0
则在表中显示记录,否则如果数组
未定义
长度===0
则在表的第一行显示
未找到记录

    <table>
        <tbody id="detailsstockid">
            <tr ng-repeat="p in viewIncompletePlanData" ng-if="viewIncompletePlanData.length>0">
                <td>{{$index+1}}</td>
                <td>{{p.date}}</td>
                <td>{{p.session}},{{p.section_name}},{{p.subject_name}},{{p.semester}}</td>
                <td>{{p.unit_name}}</td>
                <td>{{p.plan}}</td>
                <td>
                   <a>
                     <input type='button' class='btn btn-xs btn-success' value='Update' ng-click="">  
                   </a>

                </td>
            </tr>
            <tr ng-if="viewIncompletePlanData== null || viewIncompletePlanData.length === 0">
                <td>
                    No Record Found
                </td>
            </tr>
        </tbody>
    </table>

{{$index+1}}
{{p.date}}
{{p.session}}、{p.section{u name}、{{p.subject{u name}、{p.sement}
{{p.unit_name}
{{p.plan}
没有找到任何记录

试试这个:
找不到记录
如果>0找不到记录?是的,它会出现,但消息会出现在表中。