Javascript 定向分页-不显示分页链接?

Javascript 定向分页-不显示分页链接?,javascript,angularjs,angularjs-directive,dirpagination,Javascript,Angularjs,Angularjs Directive,Dirpagination,我试图在我的应用程序中使用服务器端分页,但由于缺少分页选项,我无法这样做。我在用这个 用于分页 这是我的密码: JavaScript: $scope.vm={}; // var vm = this;@TODO $scope.vm.users = []; //declare an empty array $scope. vm.pageno = 1; // initialize page no to 1 $scope. vm.total

我试图在我的应用程序中使用服务器端分页,但由于缺少分页选项,我无法这样做。我在用这个 用于分页

这是我的密码:

JavaScript:

$scope.vm={};

       // var vm = this;@TODO
        $scope.vm.users = []; //declare an empty array
        $scope. vm.pageno = 1; // initialize page no to 1
        $scope. vm.total_count = 0;
        $scope.vm.itemsPerPage = 10; //this could be a dynamic value from a drop down
        $scope.getData = function(pageno){ // This would fetch the data on page change.
            //In practice this should be in a factory.
            $scope.vm.users = [];
            //$http.get("http://localhost:8093/ProductLicensingApplication/pagingList/{itemsPerPage}/{pagenumber}").success(function(response){
            //    //ajax request to fetch data into vm.data
            //    vm.users = response.data;  // data to be displayed on current page.
            //    vm.total_count = response.total_count; // total data count.
            //});
            var params = {
                pageno:  $scope.vm.pageno,
                itemsPerPage:  $scope.vm.itemsPerPage
            };
            featureService.getPagingFeatures(params).then(function (response) {

                console.log("Getting paging Feature list..");
                console.log(response.status);
                if (response.status.name == "OK") {
                    $scope.vm.users = response.pagingFeaturesList;  // data to be displayed on current page.
                    $scope.vm.total_count = response.total_count; // total data count.
                    console.log("paging success");
                    console.log( $scope.vm.users);
                    console.log( $scope.vm.total_count);
                } else {

                }
            }, function (error) {
                console.log(error);
            });

        };
        $scope.getData( $scope.vm.pageno);
HTML:


SR#
名称
代码
描述
是活跃的
正在加载新数据!!
{{$index+1}}
{{user.name}
{{user.code}}
{{user.description}}
{{user.isActive}
现在我的桌子是这样显示的


请告诉我如何在我的表格下方添加分页链接,我在stack overflow和google上使用了不同的解决方案,但对我不起作用。

您可以在Html中使用以下代码:

<pagination ng-model="page"
                        page="pagingInfo.page"
                        total-items="pagingInfo.totalItems"
                        items-per-page="pagingInfo.itemsPerPage"
                        ng-change="selectPage(page)"
                        max-size="10"
                        rotate="false"
                        boundary-links="true"></pagination>

上面的代码正在与我一起工作。

您使用controllerAs或scope?我不知道您确切的要求是什么?您可以检查控制台是否有任何错误吗?控制台上没有显示错误您将getData分配给$scope而不是$scope.vm但您将其用作page change=“vm.getData(newPageNumber)”上的。但这可能不是主要问题。我认为您必须显示分页组件。问题是什么?您得到的记录数是多少?大于10?我返回所有记录,但在一页中仅显示10条记录。
<pagination ng-model="page"
                        page="pagingInfo.page"
                        total-items="pagingInfo.totalItems"
                        items-per-page="pagingInfo.itemsPerPage"
                        ng-change="selectPage(page)"
                        max-size="10"
                        rotate="false"
                        boundary-links="true"></pagination>
$scope.pagingInfo = {
            page: 1,
            itemsPerPage: 10,
            sortBy: 'NO',
            reverse: false,
            search: '',
            totalItems: 0
        };



  $scope.selectPage = function (page) {
        $scope.pagingInfo.page = page;


        getPagingFeatures();
    };

featureService.getPagingFeatures($scope.pagingInfo).then(function (response) {

                console.log("Getting paging Feature list..");
                console.log(response.status);
                if (response.status.name == "OK") {
                    $scope.vm.users = response.pagingFeaturesList;  // data to be displayed on current page.
                    $scope.vm.total_count = response.total_count; // total data count.
                    console.log("paging success");
                    console.log( $scope.vm.users);
                    console.log( $scope.vm.total_count);
                } else {

                }
            }, function (error) {
                console.log(error);
            });

        };