Разбиение на страницы Angularjs отображает содержимое на основе ограничения, но не отображает номера страниц для навигации между страницами - PullRequest
0 голосов
/ 21 мая 2018

enter image description here Поэтому я использую angularjs для отображения содержимого, полученного из mySQL.Я пытаюсь создать нумерацию страниц с помощью angularjs, чтобы отобразить их определенное количество на каждой странице.Моя проблема в том, что в VIEW он отображает содержимое на основе предела, определенного в контроллере, однако он не отображает номера страниц, которые я могу использовать для навигации по страницам.есть мысли ???

Вот мой код:

<!-- the VIEW -->
<div class="container testing" ng-controller="musicControl">
    <table>
      <tr ng-repeat="post in posts | startFrom:(currentPage-1)*entryLimit | limitTo:entryLimit">
        <td style="padding:15px">{{ post.postType }}</td>
        <td style="padding:15px">{{ post.postTitle | uppercase }}</td>
        <td style="padding:15px">{{ post.postDescription }}</td>
        <td style="padding:15px">{{ post.postDate | date }}</td>
        <td style="padding:15px">
            <?php 
               include "functions.php";
               placeMusic('{{ post.src | trustAsResourceUrl }}');
            ?>
        </td>
      </tr>
    </table>
    <div ng-show="filteredItems > entryLimit">
        <div pagination="" page="currentPage"
             on-select-page="setPage(page)"
             boundary-links="true" total-items="filteredItems"
             items-per-page="entryLimit" 
             class="pagination-small" previous-text="&laquo;"
             next-text="&raquo;">
        </div>
    </div>
    <br>
</div>

Модуль ->

var app = angular.module("myApp", ["ngRoute"]);     
<!-- controller -->
app.controller('musicControl', function($scope, $http) {
    $http.get("pages/db_section/music.php")
    .then(function (response) {
        $scope.posts = response.data.records;
        $scope.currentPage = 1; //current page
        $scope.entryLimit = 2; //max no of items to display in a page
        $scope.filteredItems = $scope.posts.length; //Initially for no filter  
        $scope.totalItems = $scope.posts.length;
    });
    $scope.setPage = function(pageNo) {
        $scope.currentPage = pageNo;
    };

});




<!-- filter -->
app.filter('trustAsResourceUrl', ['$sce', function($sce) {
    return function(val) {
        return $sce.trustAsResourceUrl(val);
    };
}]);

app.filter('startFrom', function() {
    return function(input, start) {
        if(input) {
            start = +start; //parse to int
            return input.slice(start);
        }
        return [];
    }
});
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...