-
Notifications
You must be signed in to change notification settings - Fork 116
BUG? jqPagination and angular data binding #41
Description
This following angular data bindings ({{data}} to the inputs data attributes do not work.
With
<div class="credacious-pagination">
<a href="#" class="first" data-action="first">«</a>
<a href="#" class="previous" data-action="previous">‹</a>
<input type="text" readonly="readonly" data-current-page="{{currentViewScope.o_conversationService.currentPage}}"
data-max-page="{{currentViewScope.o_conversationService.maxPages}}"
data-page-string="Page" {{{currentViewScope.o_conversationService.currentPage}}} "of" {{{currentViewScope.o_conversationService.maxPages}}}/>
<a href="#" class="next" data-action="next">›</a>
<a href="#" class="last" data-action="last">»</a>
</div>
The control's input field looks like this:
"Page 1 of {{currentViewScope.o_conversationService.maxPages}}"
which is incorrect. Also, clearly the two data attributes are working differently
(The above bindings work correctly elsewhere in the html)
Initialization of jqPagination has also been included in the 'link' method of our associated directive (it is correctly invoked):
pagerDirectiveModule.directive('cfPager', function () {
console.log('PagerDirective');
return {
restrict: 'AEC',
// scope: {currentView: '=view'},
link: function ($scope) {
console.log('inside PagerDirective link method');
$('.credacious-pagination').jqPagination({
paged: function(page) {
console.log('inside Pagination paged');
}
});
},
templateUrl: 'partials/directives/pager.html'
};
Ideally we want to use the above data bindings directly in the HTML so when the scope reference that contains current and max pages (between {{}}'s) is updated it will update automatically correctly in the HTML like everything else we have used. (NOTE: if you know Angular, we prefer not use a $watch inside our directive to invoke the jsPagination setter/getter functions.)
Thoughts appreciated.