title: Ionic refresh list after popup
body: <p>I have a simple app that shows records from a database in a list.</p>
  
  <p>Everything works perfectly except I can't get it to refresh the list when I've edited an item or added a new item.</p>
  
  <p>I edit and add items in a popup, so that may be what is causing the issue. Do you know of a way I can force the list to refresh once I exit the popup?</p>
  
  <p>My code follows:</p>
  
  <p>app.js</p>
  
  <pre><code>// Ionic Starter App
  
  // angular.module is a global place for creating, registering and retrieving Angular modules
  // 'starter' is the name of this angular module example (also set in a &lt;body&gt; attribute in index.html)
  // the 2nd parameter is an array of 'requires'
  // 'starter.controllers' is found in controllers.js
  angular.module('starter', ['ionic', 'ngResource', 'starter.controllers', 'starter.services'])
  
  .run(function($ionicPlatform) {
    $ionicPlatform.ready(function() {
      // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
      // for form inputs)
        if (cordova.platformId === "ios" &amp;&amp; window.cordova &amp;&amp; window.cordova.plugins.Keyboard) {
        cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
        cordova.plugins.Keyboard.disableScroll(true);
  
      }
      if (window.StatusBar) {
        // org.apache.cordova.statusbar required
        StatusBar.styleDefault();
      }
    });
  })
  
  .config(function ($stateProvider, $urlRouterProvider) {
  
      // if none of the above states are matched, use this as the fallback
      $urlRouterProvider.otherwise('/');
  
      $stateProvider
  
      .state('home', {
          url: '/',
          views: {
              'header': {
                  templateUrl: 'templates/header.html',
                  controller: 'headerCtrl'
              },
              'content': {
                  templateUrl: 'templates/content.html',
                  controller: 'contentCtrl'
              },
              'footer': {
                  templateUrl: 'templates/footer.html',
                  controller: 'footerCtrl'
              }
          }
      });
  
  });
  </code></pre>
  
  <p>controller.js</p>
  
  <pre><code>angular.module('starter.controllers', [])
  
  .controller('headerCtrl', function ($scope, $ionicListDelegate, $ionicPopup, Users) {
  
      // Triggered by clicking the 'show delete buttons' button in header.html
      $scope.toggleDelete = function () {
          $ionicListDelegate.showDelete(!$ionicListDelegate.showDelete()); // toggle delete buttons in list
      };
  
      // Triggered by clicking the 'add user' button in header.html
      $scope.addUser = function () {
          $scope.user = new Users();
          // An elaborate, custom popup
          var myPopup = $ionicPopup.show({
              templateUrl: 'templates/userform.html',
              title: 'Add new user',
              subTitle: 'Firstname is mandatory',
              scope: $scope,
              buttons: [
                { text: 'Cancel' },
                {
                    text: '&lt;b&gt;Save&lt;/b&gt;',
                    type: 'button-positive',
                    onTap: function (e) {
                        if (!$scope.user.firstname) {
                            // Prevent save if first name is empty
                            e.preventDefault();
                        } else {
                            $scope.user.id = 0;
                            $scope.user.$save();
                        }
                    }
                }
              ]
          });
      };
  
  })
  
  .controller('contentCtrl', function ($scope, $ionicPopup, Users) {
  
      // Populate list with all items from database
      $scope.users = Users.query();
  
      // Triggered by clicking the 'delete user' button in content.html
      $scope.onItemDelete = function (user) {
          $scope.users.splice($scope.users.indexOf(user), 1); // remove the deleted item from the list
          user.$delete(); // delete the record from the database
      };
  
      // Triggered by clicking the 'edit user' button in content.html
      $scope.editUser = function (user) {
          $scope.user = Users.get({ id: user.id });
          // An elaborate, custom popup
          var myPopup = $ionicPopup.show({
              templateUrl: 'templates/userform.html',
              title: 'Edit user',
              subTitle: 'Firstname is mandatory',
              scope: $scope,
              buttons: [
                { text: 'Cancel' },
                {
                    text: '&lt;b&gt;Save&lt;/b&gt;',
                    type: 'button-positive',
                    onTap: function (e) {
                        if (!$scope.user.firstname) {
                            // Prevent save if first name is empty
                            e.preventDefault();
                        } else {
                            $scope.user.$update();
                        }
                    }
                }
              ]
          });
      };
  
  });
  </code></pre>
  
  <p>As mentioned earlier, the save and update work correctly - the database is updated.</p>
  
  <p>I just can't get the list to refresh when the popups close.</p>
  
  <p>I've tried <code>cache: false</code> in the 'content' state in app.js, but that didn't work.</p>
  
  <p>Any ideas?</p>