title: Update page contents after GET request in AngularJS
body: <p>On my page, I have an <code>ng-repeat='item in items'</code> to iterate through <code>$scope.items</code>.
  <code>$scope.items</code> gets its data when <code>$scope.listItems</code> is called, which uses $http get data from a REST API connected to a database. </p>
  
  <p>Initially call <code>$scope.items</code> in the controller to initialize $scope.items and populate it with data.</p>
  
  <p>Now when I add, I know that $http is working because the changes are reflected in the database. <code>$scope.items</code> is also changed according to my console logging. However, the page does not update to reflect the change.</p>
  
  <p>I think I should be using <code>$scope.$apply()</code> but I'm just getting "Error: $digest already in progress" so I'm not using it properly. I'm new to AngularJS and dont know alot of Javascript in general so bear with my ignorance.</p>
  
  <p>Here's my code.</p>
  
  <pre><code>var app = angular.module('App', []);
  app.controller('AppCtrl', function ($scope, $http) {
    $scope.listItems = function () {
      $http({method: 'GET', url: '/api/items'})
        .success(function (data, status, headers, config) {
          $scope.items = data;
          console.log($scope.items);
        })
        .error(function (data, status, headers, config) {
          $scope.items = data || 'Request failed';
          $scope.status = status;
        });
    }
    $scope.addItem = function () {
      $scope.itemDetails.node_type = 'record'; // since input hidden doesnt work
      $http({method: 'POST', url: '/api/items/add', data: $scope.itemDetails, 
             headers: {'Content-Type': 'application/json'}})
        .success(function (data, status, headers, config) {
          $scope.status = status;
          $scope.listItems();
          //$scope.$apply(); // throws an error
        })
        .error(function (data, status, headers, config) {
          $scope.status = status;
        });
    }
    $scope.listItems(); // initialize $scope.items
  });
  </code></pre>