title: Tracking many dynamic forms with ng-model
body: <p>I'm generating dozens of forms on my page. Each form has several parameters (<em>not</em> the same for each form). I'm generating my forms as such (simplified):</p>
  
  <pre><code>&lt;div ng-repeat='module in modules'&gt;
      &lt;form ng-submit='submitModule(module)'&gt;
          &lt;div ng-repeat='arg in module.args'&gt;
              &lt;input ng-model='models[module.name][arg.name]' id="{{ arg.name }}"&gt;
          &lt;/div&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>You can see I'm trying to assign a unique <code>ng-model</code> to each input parameter by using a two dimensional array <code>models[module.name][arg.name]</code>.</p>
  
  <p>Because I am planning on submitting this as JSON, the idea was that I could just do <code>models[some_module]</code> in my controller to get the full JSON, and then just post along.</p>
  
  <p>Unfortunately this isn't working, when trying <code>models['test_module']</code> I get undefined, instead of my object. There are no errors elsewhere in the code, I've tested extensively. The problem comes from the use of multi-dimensional arrays here which is apparently a big no-no.</p>
  
  <p>How should I handle my situation? IE: several forms, several inconsistent parameters, and a need to POST every param together as JSON.</p>
  
  <p>EDIT: For info, my controller looks like:</p>
  
  <pre><code>angular.module('app')
  .controller('InputCtrl', function($scope, InputSvc) {
      $scope.models = {};
  
      InputSvc.list().success(function(modules) {
          $scope.modules = modules;
          $scope.models['test_module'] = {}
      });
  
      $scope.submitModule = function(module) {
          console.log($scope.models['test_module']);
      };
  
  });
  </code></pre>