title: Create an AngularJS factory / object to hold an array
body: <p>How can I update this code to  hold an array of values? I want to hold FIELDNAME  and the VALUE. </p>
  
  <p>I want to set / add to the list by doing the following - add a value to the array/list.</p>
  
  <pre><code>userFilters.setData(' lastname', 'smith');
     userFilters.setData(' firstname', 'bob');
     userFilters.setData(' Mi', 'D');
  </code></pre>
  
  <p>And have the object hold an Array of</p>
  
  <pre><code>'lastname','smith'
  'firstname','bob'
  'mi','D'
  </code></pre>
  
  <p>&nbsp;</p>
  
  <pre><code>App.factory('userFilters', [function () {
  
      var data = {};
  
      var getData = function (field) {
          return data[field];
      };
  
      var setData = function (field, value) {
          data[field] = value;
      };
  
      return {
          getData: getData,
          setData: setData
      }
  }]);
  </code></pre>