title: angularjs ng-table is not showing data on returning to listing
body: <p>I'm using AngularJS 1.2.10 stable with a Rails project and I'm trying to get ng-table working with my data and nothing is showing up.</p>
  
  <p>I've included the ng-table files and included it in my angular module. I'm getting data when I refresh the page, but if I navigate away from this view, then back again within the single page app it's not loading the data. ie: Refresh the browser on the listing and all the data is there, I go to view an individual item and I'm taken to a new page (via angularJS routing) then I return to the listing (via angularJS routing again) and the data is empty/there is no listing.</p>
  
  <p>Here is my table</p>
  
  <pre><code>&lt;table ng-table="tableParams" class="table"&gt;
    &lt;tr ng-repeat="debtor in debtors"&gt;
      &lt;td data-title="'Code'" sortable="'code'"&gt;{{debtor.code}}&lt;/td&gt;
      &lt;td data-title="'Name'" sortable="'name'"&gt;{{debtor.name}}&lt;/td&gt;
      &lt;td&gt;
        &lt;a href="/api#/clients/{{debtor.id}}"&gt;Show&lt;/a&gt;
        &lt;a href="/api#/clients/{{debtor.id}}/edit"&gt;Edit&lt;/a&gt;
        &lt;a href="" ng-confirm-click="destroy(debtor.id)"&gt;Delete&lt;/a&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Here is my controller where I get my data.</p>
  
  <pre><code>app.controller "DebtorsController", ['$window', '$scope', '$http', '$location', '$state', '$stateParams', '$modal', '$timeout', 'flash', 'Common', 'Debtor', 'Client', 'ngTableParams', '$filter', ($window, $scope, $http, $location, $state, $stateParams, $modal, $timeout, flash, Common, Debtor, Client, ngTableParams, $filter) -&gt;
  
    # --------------------------------------------------------------------------------
    # Initialise
    # --------------------------------------------------------------------------------
    $scope.debtors = {}
  
    # --------------------------------------------------------------------------------
    # Index
    # --------------------------------------------------------------------------------
    if $state.current.name == "debtors"
      Debtor.query {},
        (data) -&gt;
          # Define ng-table params
          $scope.tableParams = new ngTableParams({
            page: 1,
            total: data.length,
            count: 10
          })
  
    # --------------------------------------------------------------------------------
    # Index
    # --------------------------------------------------------------------------------
    if $state.current.name == "debtors"
      $data = []
      Debtor.query {}, (response) -&gt; $data = response
      console.log "debtors index"
  
      $scope.tableParams = new ngTableParams({
        page: 1,
        count: 10,
        sorting: { name: 'asc'}
      }, {
        total: $data.length,
        getData: ($defer, params) -&gt;
          console.log "run deferred"
          orderedData = (if params.sorting then $filter('orderBy')($data, params.orderBy()) else $data)
          $defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count()))
      })
  </code></pre>
  
  <p>I can see in chromes console that it's calling</p>
  
  <pre><code>XHR finished loading: "http://localhost:3000/assets/layouts/default.html.erb". angular-min.js?body=1:1825
  XHR finished loading: "http://localhost:3000/assets/debtors/index.html.erb". angular-min.js?body=1:1825
  
  debtors index  
  
  ngTable: set settings 
  Object {$scope: null, $loading: false, data: null, total: 0, counts: Array[4]…}
   angular-min.js?body=1:2147
  ngTable: set parameters 
  Object {page: 1, count: 10, filter: Object, sorting: Object, group: Object…}
   angular-min.js?body=1:2147
  XHR finished loading: "http://localhost:3000/debtors". angular-min.js?body=1:1825
  XHR finished loading: "http://localhost:3000/assets/debtors/_listing.html.erb". angular-min.js?body=1:1825
  ngTable: reload data angular-min.js?body=1:2147
  ngTable: current scope 
  $get.h.$new.a {$id: "006", this: $get.h.$new.a, $$listeners: Object, $$listenerCount: Object, $parent: $get.h.$new.a…}
   angular-min.js?body=1:2147
  
  run deferred
  
  ngTable: reload data angular-min.js?body=1:2147
  ngTable: current scope 
  $get.h.$new.a {$id: "006", this: $get.h.$new.a, $$listeners: Object, $$listenerCount: Object, $parent: $get.h.$new.a…}
   angular-min.js?body=1:2147
  
  (I clicked on 'show' for one of the items)
  
  XHR finished loading: "http://localhost:3000/assets/clients/show.html.erb". angular-min.js?body=1:1825
  XHR finished loading: "http://localhost:3000/clients/2". angular-min.js?body=1:1825
  XHR finished loading: "http://localhost:3000/locations.json". angular-min.js?body=1:1825
  
  (I clicked on 'listing' which takes me back to the debtors listing)
  
  debtors index
  
  ngTable: set settings 
  Object {$scope: null, $loading: false, data: null, total: 0, counts: Array[4]…}
   angular-min.js?body=1:2147
  ngTable: set parameters 
  Object {page: 1, count: 10, filter: Object, sorting: Object, group: Object…}
   angular-min.js?body=1:2147
  ngTable: reload data angular-min.js?body=1:2147
  ngTable: current scope 
  $get.h.$new.a {$id: "017", this: $get.h.$new.a, $$listeners: Object, $$listenerCount: Object, $parent: $get.h.$new.a…}
   angular-min.js?body=1:2147
  
  run deferred
  
  ngTable: reload data angular-min.js?body=1:2147
  ngTable: current scope 
  $get.h.$new.a {$id: "017", this: $get.h.$new.a, $$listeners: Object, $$listenerCount: Object, $parent: $get.h.$new.a…}
   angular-min.js?body=1:2147
  XHR finished loading: "http://localhost:3000/debtors". 
  </code></pre>
  
  <p>On returning to the debtors listing it is not calling these two lines:</p>
  
  <pre><code>XHR finished loading: "http://localhost:3000/debtors". angular-min.js?body=1:1825
  XHR finished loading: "http://localhost:3000/assets/debtors/_listing.html.erb". angular-
  </code></pre>
  
  <p>I think it has to reload the data, not so much the template though as I can see that.</p>