Commit 2f868f5c authored by đinh thị đầm's avatar đinh thị đầm

new commit

parent 7c7e1d07
/**
*
*/
angular.module("myApp", ['ui.router']).config(function ($stateProvider, $urlRouterProvider, $locationProvider) {
angular.module("myApp", ['ui.router','ui.bootstrap']).config(function ($stateProvider, $urlRouterProvider, $locationProvider) {
$locationProvider.hashPrefix('');
$urlRouterProvider.otherwise("/employees");
......
......@@ -2,7 +2,9 @@
<div class="row">
<div class="col-md-8">
<tr>
<td><a class="btn btn-info" href="#" ui-sref="createEmployee">Add</a></td>
</tr>
<table class="table">
<thead>
......@@ -48,9 +50,7 @@
<div data-pagination="" data-num-pages="numOfPages()"
data-current-page="curPage" data-max-size="maxSize"
data-boundary-links="true"></div>
<tr>
<td><a class="btn btn-info" href="#" ui-sref="createEmployee">Add</a></td>
</tr>
</div>
......
......@@ -94,25 +94,32 @@ angular.module("myApp").controller("employeeController", function ($scope, $http
// $scope.reload();
// $scope.curPage = 1,
$scope.page = function (emp) {
$scope.curPage = 1,
$scope.empPerPage = 3,
$scope.itemsPerPage = 3,
$scope.maxSize = 5;
this.emp = $scope.emp;
$scope.numOfPages = function () {
return Math.ceil(emp.length / $scope.empPerPage);
return Math.ceil($scope.emp.length / $scope.itemsPerPage);
};
$scope.$watch('curPage + numPerPage', function () {
var begin = (($scope.curPage - 1) * $scope.empPerPage),
end = begin + $scope.empPerPage;
$scope.$watch('curPage + numPerPage', function() {
var begin = (($scope.curPage - 1) * $scope.itemsPerPage),
end = begin + $scope.itemsPerPage;
$scope.employess = emp.slice(begin, end);
$scope.employess = $scope.emp.slice(begin, end);
});
};
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment