title: Angular.js view not being updated after receiving message from broadcast
body: <p>After saving a resource in angular.js, I want to broadcast the changes so a list view can be updated. </p>
  
  <pre><code>    function EnvironmentCtrl($rootScope,  $scope, $location, $routeParams, environmentService) {
        environmentService.get($scope, $routeParams.id);
        $scope.id = $routeParams.id
  
        $scope.save = function(){
           $scope.environment.$save(function(data) {
             $rootScope.$broadcast("model-update");
           });
        } 
      }
  
     function NavController($scope, $http, $routeParams, environmentService) {
       environmentService.list($scope);
       $scope.$on("model-update", function(){
         environmentService.list(function(data){
           $scope.environments = data;
           console.log("update called", $scope.environments); 
         });
       });
     }
  </code></pre>
  
  <p>The communication between these controllers when EnvironmentCtrl.save is called works ok. The console.log gets called and the data returned to the callback by the service gets correctly set in the $scope.  </p>
  
  <p>The relevant part of my service looks like this:</p>
  
  <pre><code> services.factory('environmentService', [ '$resource', function($resource) {
     var environmentService = {};
  
     environmentService.list = function(callback) {
       var url = "/service/environment/"
       $resource(url).query(function(data) {
         callback(data);
       });
      }
      return environmentService;
    } ]);
  </code></pre>
  
  <p>My view looks like:</p>
  
  <pre><code>  &lt;li data-ng-repeat="env in environments"&gt;
      &lt;a href="#/environment/{{env.id}}"&gt;{{env.name}}&lt;/a&gt;
    &lt;/li&gt;
  </code></pre>
  
  <p>But doesn't get updated until a refresh.</p>
  
  <p>This is all 'within angular' (as far as I see) and I would have thought that it would 'just work'. I've tried calling $digest from within the callback. $apply complains a digest is already in progress.</p>
  
  <p>Can anyone tell me why the view does not get updated?</p>