我正在使用ng-repeat创建一个表,我想在该表下面实现分页。
控制器:
var app = angular.module('myApp', []);
$scope.GetAllData = function () {
$http({
method: "post",
url: "http://localhost:12345/Employee/Get_AllEmployee"
}).then(function (response) {
$scope.employees = response.data;
}, function () {
alert("Error Occured!");
})
};
查看:
<div ng-app="myApp" style="margin:5px 5px 5px 5px">
<div ng-controller="myCtrl" ng-init="GetAllData()" class="divList">
<table cellpadding="12" class="table table-bordered table-hover">
<thead>
<tr>
<td>
<b>ID</b>
</td>
<td>
<b>Name</b>
</td>
<td>
<b>City</b>
</td>
<td>
<b>Contact</b>
</td>
<td>
<b>EmailID</b>
</td>
<td class="col-md-2">
<b>Actions</b>
</td>
</tr>
</thead>
<tr ng-repeat="Emp in filteredEmp | filter: queryText">
<td>
{{Emp.CustomerID}}
</td>
<td>
{{Emp.Name}}
</td>
<td>
{{Emp.Address}}
</td>
<td>
{{Emp.Mobileno}}
</td>
<td>
{{Emp.EmailID}}
</td>
<td>
<input type="button" class="btn btn-warning" value="Update" ng-click="UpdateEmp(Emp)" />
<input type="button" class="btn btn-danger" value="Delete" ng-click="DeleteEmp(Emp)" />
</td>
</tr>
</table>