V
V
Vladislav2016-06-15 15:21:47
Angular
Vladislav, 2016-06-15 15:21:47

The question is how can I make ng-repeat pagination?

Help with pagination.. I can't figure it out

var myApp = angular.module('myApp', []);
myApp.controller('app', ['$http',
    function($http) {
        var vm = this;
        vm.products = {};
        vm.setpage = setpage;
        vm.lastpage = 0;

        getdata();
        
        function setpage(page) {
            getdata(page);
        }

        function getdata(count) {

            count = (!count) ? 5 : count; // if вывод по 5 

            var config = {

                headers: {
                    "setr-tenant": "test",
                }
            };	
            $http.get('http://api.test.ru/shop/products?count=' + count, config).success(function(data) {
                vm.products = data.data;
                vm.lastpage = data.last_page;
                
            });
        }
    }
]);

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question