I've created a pager template for a knockout viewmodel
<script type="text/html" id="custom_pager_template">
<ul class="pagination">
<li class="disabled"><a href="#">«</a></li>
<!-- ko foreach: ko.utils.range(0, maxPageIndex) -->\
<li class="active"><a href="#" data-bind="text: $data + 1, click function() { $root.currentpageindex($data) }, css { selected $data= =$root.currentPageIndex() }"><span class="sr-only"></span></a></li>
<!-- /ko -->
</ul>
</script>
But when i run this i get the following error:
Uncaught SyntaxError: Unable to process binding "simpleGrid: function (){return gridViewModel }" Message: Unable to process binding "foreach: function (){return ko.utils.range(0,maxPageIndex) }" Message: Unable to parse bindings. Bindings value: text: $data + 1, click function() { $root.currentpageindex($data) }, css { selected $data= =$root.currentPageIndex() } Message: Unexpected token )
So how can i use ko functions inside a template?