分页 - 如何在我的函数中传递按钮值作为争论 [英] Pagination - how do I pass button value as arguement in my function
本文介绍了分页 - 如何在我的函数中传递按钮值作为争论的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试创建分页。
而不是锚标记,我正在使用按钮。我需要将按钮的值作为ng-click事件中的函数的参数之一传递的页数。
我该怎么做?
我尝试过:
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>';
}
推荐答案
这就是我实施的方式:
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>
我可以使用输入而不是span。它无论如何都会有用。
I could have used input instead of span. It would have worked anyway.
这篇关于分页 - 如何在我的函数中传递按钮值作为争论的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文