javascript - Angular ng-repeat 不显示项目
问题描述
我以前使用过 angularjs,但由于某种原因,我似乎无法让它遍历我的数组。
如果我查看浏览器的控制台,我可以看到它不是空的
这是我的代码。
AngularJS
$scope.Clients = [];
$scope.LoadClients = function () {
$.get('/Client/GetClientList').then((d) => {
angular.copy(d.results, $scope.Clients);
console.log($scope.Clients);
$("#clientTable").DataTable();
});
};
HTML
<table class="table table-bordered" id="clientTable" width="100%" cellspacing="0">
<thead>
<tr>
<th>Name</th>
<th>Active</th>
<th>Nr. Branches</th>
<th></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="client in Clients">
<td ng-bind="client.Name"></td>
<td class="text-center" ng-bind="client.Active"></td>
<td class="text-center" ng-bind="client.Branches.length" ng-click="ViewBranches($index)"></td>
<td class="text-center">
<div class="btn-group" role="group" aria-label="">
<button type="button" class="btn btn-primary btn-xs" ng-click="ViewClient($index)">
<span class="fa fa-eye"></span>
</button>
<button type="button" class="btn btn-warning btn-xs" ng-click="ViewBranches($index)">
<span class="fa fa-list"></span>
</button>
<button type="button" class="btn btn-danger btn-xs" ng-click="DeleteClient($index)">
<span class="fa fa-trash"></span>
</button>
</div>
</td>
</tr>
</tbody>
</table>
解决方案
推荐阅读
- python - 使用python从上到下依次读取VISIO文件的内容
- azure-eventgrid - 事件网格未将 IoT 中心连接/断开连接事件发送到存储队列
- mysql - 与 MySQL 的 ASP.NET Core 会话
- reactjs - RefferenceError:找不到变量 React
- selenium - 有没有办法从 Selenium Cucumber testng 框架中的 @DataProvider 注释中获取数据?
- python - 从 AWS lambda 将文件上传到 S3 时出现 MD-5 校验和错误
- airflow - 云作曲家解析 json
- sql - 在动态 sql 查询中将 varchar 转换为数字时出错
- java - 如何修复 maven 异常:[错误] 无法执行目标 org.apache.maven.plugins:maven-clean-plugin:2.6.1:clean
- php - 函数中的php变量范围?