Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have situation that there could be more than 200+ of page numbers i need to create so i decided to show the page numbers in dropdown list.

I am currently using angular js.

Each page number would be passing argument which will make call to server to load another batch of data in the table.

What I have tried:

$http({
        method: "POST",
        url: "Detail.aspx/GetData",
       
        data: JSON.stringify({ dateString: dateValue, pageNumber: pgNum }),
        contentType: "application/json",
        dataType: "json"

    }).then(function (response) {

        var AllObject = JSON.parse(response.data.d);
        $scope.Data = AllObject[0];

        debugger;
        var PageDetail = AllObject[1];
        $scope.pg = PageDetail;
        debugger;
        });


    var numOfPagToDisplay = $scope.pg.numOfPagToDisplay;

  var k =  function(numOfPagToDisplay) {
      var pgNumArray = new (numOfPagToDisplay);
      var c = 1;
      for (var i = 0; i < numOfPagToDisplay; i++) {

          pgNumArray[i] = c;
          c++;
      }
      return pgNumArray;
    }
  $scope.PgNumList = k($scope.pg.numOfPagToDisplay);


HTML Code:
html is : 

Number Of Data in server : {{::pg.TotalNumber}}
Number Of Records displayed : {{::pg.DisplayedNumberOfRows}}
Number Of Records Remains : {{::pg.NumOfRemaingData}}
Num Of Pages label to create : {{pg.NumOfPageToDisplay}}
Page Numbers: <'select >
<''option ng-repeat="p in PgNumList" value="{{p}}" >{{p}}<'/'option>
<'-select>

<'/p'>
Posted
Updated 9-Jul-17 22:30pm

1 solution

<select >
<option ng-repeat="p in PgNumList" value="{{p}}" >{{p}}</option>
</select>
 
Share this answer
 
Comments
[no name] 10-Jul-17 5:56am    
Thats what i did exactly but it did not work. I get empty list.
[no name] 10-Jul-17 6:17am    
Thank you sir once again , coming out and trying to help me out. Actually I found my mistake. I have misspelled $scope.pg.NumOfPageToDisplay to $scope.pg.mumOfPagToDisplay.

Its working fine now.
Karthik_Mahalingam 10-Jul-17 6:19am    
welcome
Maciej Los 11-Jul-17 2:14am    
5ed!
Karthik_Mahalingam 11-Jul-17 2:20am    
Thank you Maciej

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900