I create a client-side paged list with knockout.js and im trying to infer the page index using the code below, so I get interactive links with numbers so people can switch the page.
<ul data-bind="foreach:Paging"> <li> <a href="#" data-bind="click: $root.SetCurrentPage(), text: WHATTOWRITEHERE "></a> </li> </ul>
In my view model
this.Paging = ko.computed(function () { return ko.utils.range(1, this.TotalPages); });
Everything works, I tried only the output of the text: test and he writes a test for each page, but I want numbers. So the easiest way is, of course, accessing the current index in foreach and + 1.
How can I do this?
Kimpo source share