Skip to content
This repository was archived by the owner on Jan 2, 2021. It is now read-only.
This repository was archived by the owner on Jan 2, 2021. It is now read-only.

BUG? jqPagination and angular data binding #41

@momoadeli

Description

@momoadeli

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">&laquo;</a>
    <a href="#" class="previous" data-action="previous">&lsaquo;</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">&rsaquo;</a>
    <a href="#" class="last" data-action="last">&raquo;</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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions