title: Refresh $scope changes
body: <p>An ng-view is swapped out by routing. Here is some of the route and controller code</p>
  
  <pre><code>var containers = [];
  angular.module('AContainer',['ngRoute']).config(
  function ($routeProvider){
      $routeProvider
      .when('/', {
          controller: containerListCtrl,
          templateUrl: '/closeAndUplift_containerList.html'
      });
  }
  );
  function containerListCtrl($scope, $location){
      $scope.containers = containers;
  }
  </code></pre>
  
  <p>Here is the div</p>
  
  <pre><code>&lt;div id='containersDiv' ng-app='AContainer'&gt;
      &lt;div ng-view&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Within this a view (closeAndUplift_containerList.html) has been loaded which displays an array of objects via a ng-repeat</p>
  
  <pre><code>&lt;div&gt;
  &lt;table&gt;
      &lt;thead&gt;
      &lt;th&gt;Pallet id&lt;/th&gt;
      &lt;/thead&gt;
      &lt;tr ng-repeat='container in containers'&gt;
          &lt;td&gt;&lt;a href='#/edit/{{container.index}}'&gt;{{container.id}}&lt;/a&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p></p>
  
  <p>The problem occurs when a change results from a jquery ajax callback. The xhr calls are contained in a separate library and a callback function is passed in. The callback is supposed to clear the list of containers. The callback executes this:</p>
  
  <pre><code>var activeScope = $('#containersDiv').scope();
  activeScope.$apply( function(){
      activeScope.containers = [];
  });
  </code></pre>
  
  <p>But nothing happens. The old values are still displaying.</p>
  
  <p>EDIT:
  I re-arranged the code to take advantage of $http as per Rishul's suggestion to make it work. The problem is that while it is a work-around, it doesn't really answer the question as to why the method I used did not work.
  Can someone comment on whether his answer should be selected as solving the problem?</p>