title: How to trigger a model update from $resource.save()?
body: <p>I'm currently trying to build my first angular app, and I could need a little help.</p>
  
  <p>I'm accessing a REST service with the standard $resource actions:</p>
  
  <pre><code>angular.module('wtrack', ['ngResource']).
      factory('WtrackAPI', function($resource) {
        var WtrackAPI = $resource('http://hostname/wtrack/api/w/:id');
        return WtrackAPI;
      });
  </code></pre>
  
  <p>And this is my controller:</p>
  
  <pre><code>function ListCtrl($scope, $timeout, WtrackAPI){
  
      $scope.wdata = WtrackAPI.query(); // a list of objects displayed in my view
  
      $scope.addEntry = function() {   // adding an object to the list
          console.log("Adding Entry");
          var entry = {day: $scope.wdata.day, value: $scope.wdata.value};
          WtrackAPI.save(entry, 
                            function(){console.log("WTF do I need to do here to rerun WtrackAPI.query()");});
      };
  
  }
  </code></pre>
  
  <p>What I'd want to do is basically update my model by executing <code>$scope.wdata = WtrackAPI.query();</code> again once the save() is done. I suspect the angular way would be to just <code>$scope.wdata.push(entry)</code>, but in this case the database adds some data to the entry with triggers and does some complex sorting, so I really want to roundtrip and reload the whole list using query. How can I make this happen? Just calling <code>$scope.wdata = WtrackAPI.query();</code> in the save callback doesn't work as $scope apparently doesn't exist in there. I tried a few other things with $emit and $rootScope etc, but all that did was making me really confused. So please, can anybody give me a hint on what's the proper way to do that?</p>