title: ngtable server side pagination
body: <p>Hello I try figure out how make server side pagination with angularjs an ngtable.</p>
  
  <p>I have two web services:</p>
  
  <p><code>localhost:8080/app/api/period</code> Method <code>GET</code> return json list of entities. As parameters are passed page number, range of start period and range when it stop.</p>
  
  <p><code>localhost:8080/app/api/period/count</code> Method <code>GET</code> return count of periods. As parameters are passed range of start period and range when it stop.</p>
  
  <pre><code>    this.tableParams = new ngTableParams({
          page: 1,
          count: 10
      }, {
          counts: [10],
          total: 0,
          getData: function($defer, params) {
              $http.get('/app/api/period', {params: {
                  pageNumber:params.page() - 1,
                  rangeStart:rangeStart,
                  rangeStop:rangeStop}})
                  .success(function(data, status) {
  
                     params.total($http.get('/app/api/period/count', {params: {
                          rangeStart:rangeStart,
                          rangeStop:rangeStop}}));
  
                     $defer.resolve(data);
                  });
          }
      });
  </code></pre>
  
  <p>Table <code>params.total</code> isn't updated corectly so data in table are displayed but pagination buttons aren't visible.</p>
  
  <p>Could anybody explain me how to use <code>$http.get</code> inside of success listener of other <code>$http.get</code> in this case to get correctly setted <code>params.total</code>.</p>