I am making ng-click inside ng-repeat and I want to change a variable current page with $ index value . But it does not work properly, $ index does not return a number as print string. This is my code:
& lt; Li ng- Repeatable = "Tracking me by getting-number number (paygemember) $ index" & gt; & Lt; A href = "#" ng-click = "current page = $ index" & gt; {{$ Index} 1 /} & gt; & Lt; / Li & gt;
Update: I want to write the ng-click statement inline in HTML, do not call the function in the controller.
Use the setCurrentPage
:
< Code> & lt; Li ng-repeat = "$$ track index" in getNumber (pagenumber) & gt; & Lt; A href = "#" ng-click = "Set Current Page ($ Index)" & gt; {{$ Index + 1}} & lt; / A & gt; & Lt; / Li & gt;
In Administrator:
$ scope.setCurrentPage = function {index} {$ Scope .currentpage = index; }
Note: index
is already a number, no conversion required.
No comments:
Post a Comment