title: How to use name="array[]" on forms in angularjs
body: <p>I have a structure like this </p>
  
  <pre><code>$scope.mydata = {
   'attribute': 'value',
   'otheratribute'  : 'othervalue',
   'thirdatribute' : {
        'name': 'xx',
        'desc': 'yy'
    }
  }
  </code></pre>
  
  <p>and input to the <code>thirdatribute</code> like this </p>
  
  <pre><code>&lt;form name="myForm"&gt;
    &lt;div ng-class="{ 'has-error': myForm.thirdatribute.name.$invalid }"&gt;
      &lt;span&gt;My subdata&lt;/span&gt;
  
      &lt;input name="thirdatribute['name']" type="text" 
             ng-model="mydata.thirdatribute.name" required&gt;
  
    &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>the root atributes <code>attribute</code> and <code>otheratribute</code> validation work fine but the <code>thirdatribute</code> throw an error on console:</p>
  
  <pre><code>TypeError: Cannot read property '$invalid' of undefined
  </code></pre>
  
  <p>some idea that i can do?</p>