Could someone please help me with this issue I'm facing?
Here is the code snippet:
(function () {
var app = angular.module('store', ['ui.bootstrap']);
app.controller('StoreController', function ($scope, $http) {
$scope.pageSize = 20;
$scope.currentPage = 1;
$http.get("../scripts/products.php").success(function (data) {
$scope.products = data;
});
}).filter('startFrom', function () {
return function (data, start) {
return data.slice(start);
};
});
})();
And the HTML code:
<div class="col-md-2 product " ng-hide="product.soldOut" ng-repeat="product in products| orderBy:sortorder | filter: searchBox | startFrom:(currentPage - 1) * pageSize | limitTo: pageSize">
<img src="../products/{{product.image}}">
<h4>{{product.nazwa}}
<br>
<br>
</h4>
<strong>{{product.cena| currency:"PLN "}}</strong>
<div class="colored">{{product.usagee}}</div>
<div class="buttons">
<a href="/product/{{product.id}}" class="btn btn-default btn-sm" style="">Details</a>
<a href="/product/{{product.id}}" class="btn btn-success btn-sm" ng-show="product.dostepny">Buy</a>
</div>
</div>
<div class="col-md-12">
<uib-pagination class="pagination-sm" previous-text="Previous" next-text="Next" total-items='products.length' ng-model='currentPage' items-per-page='pageSize'></uib-pagination>
</div>
I've searched on Google and Stack Overflow but couldn't find a suitable solution.