0

I am building a custom Angular directive to display pagination across my application.

I'm using isolated scope to pass totalNoOfRecords but it's not getting displayed. Any help will be appreciated

Here's my code what I tried so far

Template where I'm calling the directive:

<pagination totalData="111"></pagination>

Directive.js

function pagination() {
    return {
        restrict: 'EA',
        templateUrl: 'template/directives/pagination.html',
        scope: {
            totalData: '@',
        },
        link: dirPaginationControlsLinkFn
    };
}

Directive Template

<span class="pagination-text">
   of {{totalData}} 
</span>
georgeawg
  • 48,608
  • 13
  • 72
  • 95
Shashank
  • 437
  • 2
  • 6
  • 21

1 Answers1

1

In AngularJS, the scope bindings should be in camelCase in JS and in kebab-case in HTML.

You have to change your HTML from

<pagination totalData="111"></pagination>

to

<pagination total-data="111"></pagination>
georgeawg
  • 48,608
  • 13
  • 72
  • 95
Julien
  • 2,256
  • 3
  • 26
  • 31