title: ng-repeat list in AngularJS isn't updated when an ajax call changing its value
body: <p>I'm totally confused. Why doesn't my ng-repeat refresh when there's an ajax call changing its value? I've seen many Q&amp;As here, but none of them talked about ajax call.</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div class="row" ng-controller="EntryCtrl"&gt;
      &lt;div id="treeview" class="col-xs-4 col-sm-4 col-md-4 col-lg-4"&gt;
          &lt;ul&gt;
              &lt;li ng-repeat="root in rootEntry"&gt;{{root.Name}}&lt;/li&gt;
          &lt;/ul&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>function EntryCtrl ($scope, $http) {
      $scope.rootEntry = [];
      $http.get('read/root').success(function(root) {
          $scope.rootEntry = root;
          console.log($scope.rootEntry);
      });
  }
  </code></pre>
  
  <p>And the console did log an array the server returned. But the list in html never got updated. If I used <code>$scope.$apply</code>, an error concerning <code>$digest</code> would happen.</p>
  
  <p><strong>Console Output</strong></p>
  
  <pre><code>[Object]
      0: Object
          Attributes: null
          Id: "534580464aac494e24000001"
          Name: "Registry"
          Path: ""
          __proto__: Object
          length: 1
      __proto__: Array[0]
  </code></pre>
  
  <p>So it's the structure of <code>root</code> the server returns. Would it be the problem of data type? Because it's <code>Object</code> rather than <code>Array</code>. I use Golang as server and use <code>json.Marshal()</code> to pack the data from MongoDB.</p>
  
  <p><strong>Update</strong></p>
  
  <pre><code>function EntryCtrl ($scope, $http) {
      $scope.rootEntry = [];
      $http.get('read/root').success(function(root) {
          $scope.rootEntry = root;
          console.log($scope.rootEntry);
      });
      console.log($scope.rootEntry);
  }
  </code></pre>
  
  <p>The latter output is <code>[]</code>. It's likely because of async of $http, so will it the reason?</p>
  
  <p><strong>Final</strong></p>
  
  <p>I know why. I used a plugin called <code>jsTree</code>, which will do some decorations with the node, so the node I inserted would be overwritten.</p>
  
  <p>Thank you all.</p>