Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I am trying to create pagination.
Instead of anchor tag, i am using button. I need to pass number of page which will be value of button as one of an argument in function in ng-click event.

how do i do it ?

What I have tried:

for (var i = 1; i <= numPgList.length; i++) {

                template += '<li class="page-item">';

                debugger;
                if (i == CurrentPg) {
                    template += '<button class="btn btn-xs-1 btn-primary" disabled>' + [i] + '</button>';
                }
                else {
                    
                   // template += '<li class="page-item">';
                    template += '   <button class="btn btn-xs-1 btn-default" ng-click="GetData(txtDate,name, city, state, zip,data-value)" data-value=' + [i] + '>'+[i]+'</button>';
                }
               
                template += '</li>';
}
Posted
Updated 19-Jul-17 8:25am

1 solution

this is how I implemented any way:

<nav aria-label="...">
                      <ul class="pagination" id="page_ul">
                          <li class="page-item" ng-class="isActive(n) ? 'active' : ''" ng-repeat="n in sPgNumList">
                              <span class="page-link" ng-click="GetAllDetails(txtDate,city, state, zip,n))">{{n}}</span>
                          </li>
                      </ul>
                  </nav>


I could have used input instead of span. It would have worked anyway.
 
Share this answer
 
Comments
Graeme_Grant 16-Sep-17 8:07am    
Please don't answer your own question with a solution and then accept it as a valid solution. This is see as REP farming and can get you banned if continued. Update your question instead.

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