i cant put my pagination work
this is my code
what i doing wrong
<div ng-app="sa_app" ng-controller="controller" ng-init="show_data()">
<div class="col-md-3">Filter:
<input type="text" ng-model="search" ng-change="filter()" placeholder="Filter" class="form-control" />
</div>
<div class="col-md-4">
<h5>Filtered {{ filtered.length }} of {{ totalItems}} total Servicos</h5>
</div>
<div>
<table class="table table-bordered">
<tr>
<th>Id</th>
<th>Nome</th>
<th>Descricao</th>
<th>Quantidade</th>
<th>Nome da Empresa</th>
<th>Preço Sem Iva</th>
<th>Descontos</th>
<th>IVA</th>
<th>Valor Desc</th>
<th>Valor IVA</th>
<th>Preco Total</th>
<th>Edit</th>
<th>Delete</th>
</tr>
<tr ng-repeat="x in filtered = (names | filter:search | orderBy : predicate :reverse) |startFrom:(currentPage-1)*entryLimit | limitTo:entryLimit">
<td>{{x.id}}</td>
<td>{{x.nome}}</td>
<td>{{x.descricao}}</td>
<td>{{x.quantidade}} Unidade</td>
<td>{{x.Nome}}</td>
<td>{{x.precosiva}}€</td>
<td>{{x.descontos}}%</td>
<td>{{x.iva}}%</td>
<td>{{x.valordesc}}€</td>
<td>{{x.valoriva}}€</td>
<td>{{x.precototal}}€</td>
<td>
<button class="btn btn-success btn-xs" data-toggle="modal" data-target="#myModal1" ng-click="update_data(x.id, x.nome, x.descricao, x.quantidade,x.Nome,x.precosiva,x.descontos,x.iva)">
<span class="glyphicon glyphicon-edit"></span> Edit
</button>
</td>
<td>
<button class="btn btn-danger btn-xs" ng-click="delete_data(x.id )">
<span class="glyphicon glyphicon-trash"></span> Delete
</button>
</td>
</tr>
</table>
</div>
<div class="col-md-12" ng-show="filteredItems == 0">
<div class="col-md-12">
<h4>No serviços found</h4>
</div>
</div>
<div class="col-md-12" ng-show="filteredItems > 0">
<?php echo "OLA";?>
{{ filteredItems}}
<div pagination="" page="currentPage" on-select-page="setPage(page)" boundary-links="true" total-items="filteredItems" items-per-page="entryLimit" class="pagination-small" previous-text="«" next-text="»"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
var app = angular.module("sa_app", []);
/*app.filter('startFrom', function() {
return function(input,start) {
if (input) {
start = +start;
//parse to int
return input.slice(start);
}
return [];
}
});
*/
app.filter('startFrom', function() {
return function(input, start) {
if(input) {
start = +start; //parse to int
return input.slice(start);
}
return [];
}
});
app.controller("controller", function($scope, $http,$timeout) {
$scope.btnName = "Insert";
$scope.insert = function() {
if ($scope.nome == null) {
alert("Insira o nome do Servico");
} else if ($scope.descricao == null) {
alert("Insira a descricao");
} else if ($scope.quantidade == null) {
alert("insira a quantidade");
} else if ($scope.Nome == null) {
alert("insira a Nome da Empresa");
} else if ($scope.precosiva == null) {
alert("insira a O Valor do Preço");
} else if ($scope.descontos == null) {
alert("insira a O Valor do Desconto");
} else if ($scope.iva == null) {
alert("insira a O Valor do IVA");
} else {
$http.post(
"servicos/insert.php", {
'nome': $scope.nome,
'descricao': $scope.descricao,
'quantidade': $scope.quantidade,
'Nome': $scope.Nome,
'precosiva': $scope.precosiva,
'descontos': $scope.descontos,
'iva': $scope.iva,
'btnName': $scope.btnName,
'id': $scope.id
}
).success(function(data) {
alert(data);
$scope.nome = null;
$scope.descricao = null;
$scope.quantidade = null;
$scope.Nome=null;
$scope.precosiva = null;
$scope.descontos = null;
$scope.iva = null;
$scope.btnName = "Insert";
$scope.show_data();
});
}
}
$scope.show_data = function() {
$http.get("servicos/display.php")
.success(function(data) {
$scope.names = data;
$scope.currentPage = 1;
//current page
$scope.entryLimit = 5;
//max no of items to display in a page
$scope.filteredItems = $scope.names.length;
//Initially for no filter
$scope.totalItems = $scope.names.length;
});
}
$scope.show_data1 = function() {
$http.get("servicos/display1.php")
.success(function(data) {
$scope.names1 = data;
});
}
$scope.update_data = function(id,nome,descricao,quantidade,Nome,precoiva,descontos,iva) {
$scope.id = id;
$scope.nome = nome;
$scope.descricao =descricao;
$scope.quantidade = quantidade;
$scope.Nome=Nome;
$scope.precosiva = precoiva;
$scope.descontos= descontos;
$scope.iva = iva;
$scope.btnName = "Update";
}
$scope.setPage = function(pageNo) {
$scope.currentPage = pageNo;
};
$scope.filter = function() {
$timeout(function() {
$scope.filteredItems = $scope.filtered.length;
}, 10);
};
$scope.sort_by = function(predicate) {
$scope.predicate = predicate;
$scope.reverse = !$scope.reverse;
};
$scope.delete_data = function(id) {
if (confirm("Are you sure you want to delete?")) {
$http.post("servicos/delete.php", {
'id': id
})
.success(function(data) {
// alert(data);
$scope.show_data();
});
} else {
return false;
}
}
});
</script>