title: Angular 2 template form validation not working
body: <p>I am working on an example of Angular 2 template template driven forms and started with basic validation and it does not work.</p>
  
  <p>I checked the systex from the video tutorial that I am referring and I have done exactly the same thing that has been shown in video.</p>
  
  <p>The issue is when I hit Submit/OK button, it does not give any validation error message. I am also attaching the error message that appears in the tutorial video.</p>
  
  <p><strong>Code Sample 1:</strong></p>
  
  <p>HTML file of component:</p>
  
  <pre><code>&lt;form #form="ngForm" &gt; 
  
      &lt;input 
        type="text"
        id="name"
        required 
        placeholder="Name" 
        name="name" 
        ngModel&gt;
      &lt;button type="submit"&gt;OK&lt;/button&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>TS File:</p>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  
  @Component({
    selector: 'my-details',
    templateUrl: './details.component.html',
    styleUrls: ['./details.component.scss']
  })
  export class DetailsComponent implements OnInit {
  
    constructor() {
      // Do stuff
    }
  
    ngOnInit() {
      console.log('Hello About');
    }
  
  }
  </code></pre>
  
  <p>I also tried by adding <strong>form-control</strong> tags, but it also didn't worked</p>
  
  <p><strong>Code Sample 2:</strong></p>
  
  <p>Modified HTML file of the above mentioned component:</p>
  
  <pre><code>&lt;form #form="ngForm" &gt; 
  
    &lt;div class="form-group"&gt;
      &lt;input 
        type="text"
        class="form-control"
        id="name"
        required 
        placeholder="Name" 
        name="name" 
        ngModel&gt;
      &lt;button type="submit"&gt;OK&lt;/button&gt;
    &lt;/div&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/8Lvzh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8Lvzh.png" alt="enter image description here"></a></p>