Encountering an error on an overview page I've developed. I added pagination to an overview table. The pagination functions properly, but upon loading the page, an error is thrown:
"TypeError: undefined is not a function".
I've been unable to resolve this issue, as I'm relatively new to AngularJS. The error appears to be in the custom filter created on the final return line:
AngularJS:
angular.module('app').filter('pagination', function(){
return function(input, start)
{
start = +start;
return input.slice(start);
};
});
HTML:
<tbody>
<tr ng-repeat="question in questions | orderBy:order:reverse | filter:searchText | pagination: curPage * pageSize | limitTo: pageSize">
<td>{{ question.text }}</td>
<td>{{ question.times_asked }}x </td>
<td>--%</td>
<td>
<button class="btn" ng-click="createModel(question.id)">
<span class="glyphicon glyphicon-pencil"></span>
</button>
</td>
<td>
<button class="btn" ng-click="createDeleteModel(question.id)">
<span class="glyphicon glyphicon-trash"></span>
</button>
</td><td>
</tr>
</tbody>
<div class="pagination pagination-centered" ng-show="questions.length">
<ul class="pagination-controle pagination">
<li>
<button type="button" class="btn btn-primary" ng-disabled="curPage == 0"
ng-click="curPage=curPage-1"> < Previous Page</button>
</li>
<li>
<span>Page {{curPage + 1}} of {{ numberOfPages() }}</span>
</li>
<li>
<button type="button" class="btn btn-primary"
ng-disabled="curPage >= questions.length/pageSize - 1"
ng-click="curPage = curPage+1">Next Page ></button>
</li>
</ul>
</div>
Appreciate any assistance!
Thomas