title: Angular ng-repeat with ng-form, accessing validation in controller
body: <p>I am trying to generate an editable list using <code>ng-repeat</code>.  I want to remind the user to update any edits before moving on, so I am using <code>ng-form</code> to create "nested" forms on the fly because the documentation says I can then use validation on these dynamically created inputs.</p>
  
  <p>While that seems to work within the HTML, I don't see how to access those dynamically created forms and related validation fields in the controller. Specifically, when the user changes the input I use the form $dirty property to bring up a button to tell the user to commit the changes.  So far, so good.  However, once the changes are committed I want to <code>$setPristine()</code> on the field to indicate that the changes have been set.  There may be other ways of ensuring that changes are committed on each input before I allow the main form committed, but this was the best I could come up with.</p>
  
  <p>Unfortunately, even though the documentation says that if I name the ng-form it will be propagated to the <code>$scope</code> object, I can't find a way to access it.  <code>$scope.dynamic_form</code> is undefined.</p>
  
  <p>Here is a plunker showing what I mean:</p>
  
  <p><a href="http://plnkr.co/edit/L9rNMNwaVm8noNZeKwnC" rel="noreferrer">plnk</a></p>
  
  <p>Thanks!</p>
  
  <p>[EDIT] Just to add to the issue, what does work for this specific example is to add to the <code>ng-click</code> on the dynamically created input:</p>
  
  <pre><code>ng-click="namesForm.name.$setPristine();clean()"
  </code></pre>
  
  <p>But I still don't have access to the dynamically created form in the controller.  I would like, for example, to add a watcher to the <code>namesForm.name.$pristine</code> so that I can set the <code>mainForm.$setValidity(false)</code> whenever the sub-form is <code>$dirty</code> to prevent the user from submitting the main form until all sub-form changes have been committed.</p>
  
  <p>So in a nutshell, the issue is how to access in a parent controller the validation values of a dynamically created nested ngForm?</p>