简体   繁体   中英

Assign Variable inside ng-repeat with ng-click

I trying to make a pagination system but I have problems when I try update my CurrentPage Variable , when I try to make a <li ng-click="currentPage".... the variable no update please check this fragment http://jsfiddle.net/f17sLojb/3/

note: I need work only in html side, I dont want make a function in javascript for fix it , Please help me

You need to add a hierarchy to the variable inside the ng-repeat because the ng-repeat has its own scope. check here

<div ng-init="numPagin=5;page.currentPage=1"></div>

ng-click="page.currentPage=$index+1"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM