角度ng-repeat不显示项目

时间:2018-05-19 16:13:20

标签: javascript jquery angularjs angularjs-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>

0 个答案:

没有答案