title: Refresh table after an insert/update in AngularJS
body: <p>My webapp is a CRUD in which there is a list of users and operations associated with them (insert, delete, ecc).
  To add a user must fill in the fields of a modal ( bootstrap - ui ). 
  The problem is that the list is not updated automatically after insertion.</p>
  
  <p>This is my code:
  HTML:</p>
  
  <pre><code> ...
  ng-repeat="p in list"
   ...
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>var app = angular.module('app', [ 'ui.bootstrap', 'ngResource' ]);
  
  app.controller("FirstController", [
          '$scope',
          'ElementFactory',
          'ElementsFactory',
          '$uibModal',
          function($scope, ElementFactory, ElementsFactory, $uibModal) {
  
              $scope.list = ElementsFactory.query();  
  
              $scope.add = function() {
  
                  var modalAddInstance = $uibModal.open({
                      animation : true,
                      templateUrl : 'addModal.html',
                      controller : 'addModalController',
                      resolve : {
                          element : function() {
                              return $scope.element;
                          } 
                      }
                  });
              };
  
          } ]);
  
  app.controller("addModalController", function($scope, $uibModalInstance,
          ElementsFactory, element) {
  
      $scope.element = element;
  
  
  
      $scope.addCancel = function() {
          $uibModalInstance.dismiss('cancel');
      };
  
      $scope.addElement = function() {
          ElementsFactory.create($scope.element, function(){
              //REFRESH TABLE HERE ********************** 
              $uibModalInstance.close();
          });
  
  
  
      };
  
  });
  
  app.factory('ElementsFactory', [ '$resource', function($resource) {
      return $resource('rest/all', {}, {
          query : {
              method : 'GET',
              isArray : true
          },
          create : {
              method : 'POST'
          }
      });
  } ]);
  </code></pre>
  
  <p>Once add the new item , this is only visible after page refresh and not automatically . What is the code to be inserted where I indicated to you that the table will automatically update ?</p>