简体   繁体   中英

How can i display JSON data inside pagination using Angularjs?

[
{
    "id": "1",
    "titlu": "client1", 
    "subtitlu": "client1", 
    "continut": "client1 is ...",
    "bigimage": "images/client1.jpg",
    "smallimage1": "images/client1.jpg",
    "smallimage2": "images/client1.jpg",
    "smallimage3": "images/client1.jpg",
    "smallimage4": "images/client1.jpg"
},
{
    "id": "2",
    "titlu": "client2", 
    "subtitlu": "client2", 
    "continut": "client2 is ...",
    "bigimage": "images/client2.jpg",
    "smallimage1": "images/client2.jpg",
    "smallimage2": "images/client2.jpg",
    "smallimage3": "images/client2.jpg",
    "smallimage4": "images/client2.jpg"
},
{
    "id": "3",
    "titlu": "client3", 
    "subtitlu": "client3", 
    "continut": "client3 is ...",
    "bigimage": "images/client3.jpg",
    "smallimage1": "images/client3.jpg",
    "smallimage2": "images/client3.jpg",
    "smallimage3": "images/client3.jpg",
    "smallimage4": "images/client3.jpg"
} 

]

This is my client.json, I want to load the page at a time, each index of json. Something like PREV button, and will load previous id from json on my page. Can someone give me a link or something to help me.

Controller.js

animateApp.controller('projectsController', ['$scope', '$routeParams', '$http',
function($scope, $routeParams, $http){
    $http.get('res/json/client.json').success(function(data){
    $scope.projects = data;
    $scope.currentProject = 1;
});

Try this link which has data and you can bind them with your control.

JSON Link

$scope.filteredItems = $filter('filter')($scope.items, function (item) {
    for(var attr in item) {
        if (searchMatch(item[attr], $scope.query))
            return true;
    }
    return false;
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM