title: Syncing data between model instances in Angular
body: <p>I'm an angular newb. I've followed this tutorial <a href="http://www.bradoncode.com/tutorials/learn-mean-stack-tutorial/" rel="nofollow">http://www.bradoncode.com/tutorials/learn-mean-stack-tutorial/</a> 
  and have slightly modified things (I have items instead of categories). 
  Basically I've created a MEAN app, with two models, users and items. I would like to add a property to the items model called "owner" which stores the username of the user who created the model. This isn't too hard, but a problem arises if the user changes their username - the "owner" property doesn't change in the item model instances created by the user. From what I gather there are ways of syncing data between views/models/controllers, but how would I sync data between different model instances of different models. Any help is appreciated, thanks. </p>
  
  <p>Here is item.client.controller.js</p>
  
  <pre><code>'use strict';
  
  // Items controller
  angular.module('items').controller('ItemsController', ['$scope','$stateParams', '$location', 'Authentication', 'Items',
  function($scope, $stateParams, $location, Authentication, Items) {
      $scope.authentication = Authentication;
      $scope.currentPage = 1;
      $scope.pageSize = 10;
      $scope.offset = 0;
  
     // Page changed handler
     $scope.pageChanged = function() {
          $scope.offset = ($scope.currentPage - 1) * $scope.pageSize;
     };
  
      // Create new Item
      $scope.create = function() {
          // Create new Item object
          var item = new Items ({
              name: this.name,
              description: this.description,
              owner: $scope.authentication.user.username
          });
  </code></pre>
  
  <p>Here is items.client.services.js
      'use strict';</p>
  
  <pre><code>//Items service used to communicate Items REST endpoints
  angular.module('items').factory('Items', ['$resource',
  function($resource) {
      return $resource('items/:itemId', { itemId: '@_id'
      }, {
          update: {
              method: 'PUT'
          }
      });
      }
  ]);
  </code></pre>
  
  <p>And users.client.services.js</p>
  
  <pre><code>'use strict';
  
  // Users service used for communicating with the users REST endpoint
  angular.module('users').factory('Users', ['$resource',
  function($resource) {
      return $resource('users', {}, {
          update: {
              method: 'PUT'
          }
      });
     }
  ]);
  </code></pre>