title: How to set a dynamic form fields to dirty or touched with angular?
body: <p>I have a dynamic form which is generated by data received from some api, you can see and example of it <a href="https://plnkr.co/edit/WC7JjMHZA1qncfAk5VeD?p=preview" rel="nofollow noreferrer">here</a>, received data is like this:</p>
  
  <pre><code>$scope.users = [
        {
          name: 'one',
          email: 'one@one.com'
        },
        {
          name: '',
          email: 'two@two.com'
        },
        {
          name: '',
          email: 'three@three.com'
        }
      ];
  </code></pre>
  
  <p>I create a dynamic form for these items, but I have a problem that my validation messages are not shown correctly, they are similar to this one:</p>
  
  <pre><code>&lt;form name="usersForm"&gt;
          &lt;div ng-form="subForm"  ng-repeat="user in users"&gt;
  
            &lt;input name="name" type="text" ng-model="user.name" required /&gt;
            &lt;p ng-if="subForm.name.$invalid &amp;&amp; subForm.name.$touched"&gt;
              name is required
            &lt;/p&gt;
  
            &lt;input name="email" type="email" ng-model="user.email" required /&gt;
            &lt;p ng-if="subForm.email.$invalid &amp;&amp; subForm.email.$touched"&gt;
              email is required
            &lt;/p&gt;
  
          &lt;/div&gt;
       &lt;/form&gt;
  </code></pre>
  
  <p>as you can see in plunkr, I have used two approaches for doing this , one is using <code>ng-form</code> and the other using interpolation in form input names:</p>
  
  <pre><code>&lt;form name="usersForm2"&gt;
          &lt;div  ng-repeat="user in users track by $index"&gt;
  
            &lt;input name="name{{$index}}" type="text" ng-model="user.name" required /&gt;
            &lt;p ng-if="usersForm2['name' + $index].$invalid &amp;&amp; usersForm2['name' + $index].$touched"&gt;
              name is required
            &lt;/p&gt;
  
            &lt;input name="email" type="email" ng-model="user.email" required /&gt;
            &lt;p ng-if="usersForm2['email' + $index].$invalid &amp;&amp; usersForm2['email' + $index].$touched"&gt;
              email is required
            &lt;/p&gt;
  
          &lt;/div&gt;
       &lt;/form&gt;
  </code></pre>
  
  <p><strong>How can I show my validation messages to user(when the form is loaded or rendered)?</strong></p>