title: Angular - Have input save to variables in factory to be used elsewhere
body: <p>I'm creating a single page application and need to be able to display input from one template onto another. The way I have my factory currently set up is not working. Can someone help with this?</p>
  
  <p>Factory:</p>
  
  <pre><code>angular.module('BSG').factory('airplaneFactory', function() {
      var name = '';
      var last_name = '';
      var color = '';
  
      function setData(n, ln, c) {
          name = n;
          last_name = ln;
          color = c;
      }
  
      return {
          name: name,
          last_name: last_name,
          color: color,
          setData: setData
      }
  })
  </code></pre>
  
  <p>Controller: </p>
  
  <pre><code>angular.module('BSG').controller('AirplaneCtrl', ['$scope', 'airplaneFactory', function($scope, airplaneFactory) {
      'use strict';
  
      function updateFactory() {
          airplaneFactory.setData($scope.name, $scope.last_name, $scope.color);
      }
  
  }]);
  </code></pre>
  
  <p>Snippet from template where input is gathered:</p>
  
  <pre><code>&lt;h2&gt;Who is this story about?&lt;/h2&gt;
  &lt;p&gt;&lt;input type="text" placeholder="name" ng-model="name" ng-change="updateFactory()"&gt;&lt;/p&gt;
  
  &lt;h2&gt;What is {{ name }}'s last name?&lt;/h2&gt;
  &lt;p&gt;&lt;input type="text" placeholder="last name" ng-model="last_name" ng-change="updateFactory()"&gt;&lt;/p&gt;
  </code></pre>