<tr ng-repeat="documents in documentations">
<td>{{documents.document_name}}</td>
<td><input type='checkbox' ng-model='secondTrdForm.documentationId' ng-true-value='{{documents.documentationId}}' ng-false-value='' name='docs[]' id='chkId_{{documents.documentationId}}' />
</td>
</tr>
当documentations对象为空时,我得到angularjs错误doc [0]未定义。
如何检查文档列表对象是否为空并避免angularjs错误?
在角度中返回错误:
Error: data[0] is undefined
@http://localhost:82/?p=secondtrd_product&cp_id=101175&wf_id=100229:403:17
$http/promise.success/<@http://localhost:82/angular/angular.js:9971:11
processQueue@http://localhost:82/angular/angular.js:14454:28
scheduleProcessQueue/<@http://localhost:82/angular/angular.js:14470:27
$RootScopeProvider/this.$get</Scope.prototype.$eval@http://localhost:82/angular/ angular.js:15719:16
$RootScopeProvider/this.$get</Scope.prototype.$digest@http://localhost:82/angula r/angular.js:15530:15
$RootScopeProvider/this.$get</Scope.prototype.$apply@http://localhost:82/angular /angular.js:15824:13
done@http://localhost:82/angular/angular.js:10263:36
completeRequest@http://localhost:82/angular/angular.js:10435:7
requestLoaded@http://localhost:82/angular/angular.js:10376:1