title: Angular JS Refresh Pager Directive
body: <p>I have pager directive which depends on data which is received async in controller. Since pager needs to know total count to correctly render pages, I would like to hide whole pager until async data is downloaded, and then show it (but before showing, run link function to setup pager information) along with the data.</p>
  
  <p>How is this possible?</p>
  
  <pre><code>(function () {
  'use strict';
  
  angular
      .module('App.widgets')
      .directive('customPager', customPager);
  
  function customPager() {
      var pager = {
          scope: {
              pageIndex: '=',
              pageSize: '=',
              recordCount: '=',
              pageClick: '&amp;onPageClick'
          },
          replace: true,
          restrict: 'E',
          templateUrl: 'custom-pager.html',
          link: link
      }
  
      return pager;
  
      function link(scope) {
          ....
      }
  }})();
  </code></pre>