title: How Does an Angular form element have a list of child input type elements on it?
body: <p>I am curious as to how angular adds child form elements to an actual form element.  I know that if an input (input, textarea, select) has a name it will be added to the form controller.  However, it also appears that it is added to the form element itself in an indexed position (see image).</p>
  
  <p><img src="https://i.stack.imgur.com/oeeIW.png" alt="enter image description here"></p>
  
  <p>I have trawled the angular source code and cannot find how and where a control is added to the form element.</p>
  
  <p>Is this a browser thing to do with the form and/or how come only inputs (input, textarea, select) and button elements are added and not div, etc etc?</p>
  
  <p>The reason being is that you can iterate over these elements using the below code however it is not adding some custom elements (created via directives) I have.  So they are not included in the iteration although they are present on the formControl (via their name property).</p>
  
  <pre><code>angular.forEach(frmElement[0], function (ctrlElement) {
         var controller, isValid;
         ctrlElement = angular.element(ctrlElement);
         controller = ctrlElement.controller('ngModel');
  
         // do something to the control...
  });
  </code></pre>
  
  <p>Any information would be really good.</p>
  
  <p>Thanks,</p>
  
  <p>Jon</p>