title: Angular 4 display all input validation errors
body: <p>I'm starting to create my first Angular 4 app. I'm testing form validation. I created a template-driven form and I added some validators.</p>
  
  <p>Now, I want to display validation errors for a field. This is my actual code :</p>
  
  <pre><code>&lt;input id="name" name="name" class="form-control" required minlength="4" [(ngModel)]="name" #name="ngModel"&gt;
  
  &lt;div *ngIf="name.invalid &amp;&amp; (name.dirty || name.touched)" class="alert alert-danger"&gt;
    &lt;div *ngIf="name.errors.required"&gt;
      Name is required.
    &lt;/div&gt;
    &lt;div *ngIf="name.errors.minlength"&gt;
      Name must be at least 4 characters long.
    &lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>I'm afraid to write this for every input in my form! Is it possible to write something like that (of course, I tried this code but it didn't work):</p>
  
  <pre><code>&lt;div *ngIf="name.invalid &amp;&amp; (name.dirty || name.touched)" class="alert alert-danger"&gt;
    &lt;p *ngFor="let error on name.errors"&gt;{{error}}&lt;/p&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Thanx for your help :) </p>