title: How to Apply form validation inside data table in angular2
body: <p>I am trying to apply required field validation for text-box which is inside data table template.</p>
  
  <p>Required field validation message pop up properly but as there is no form tag i was not able to check form.valid in component.</p>
  
  <p>Please find below code:</p>
  
  <pre><code> &lt;data-table  id="user-grid"(reload)="reloadItems($event) [items]="userData"&gt;
  
       &lt;data-table-column [header]="'UserName'"&gt;
            &lt;template #dataTableCell let-item="item"&gt;
                &lt;span&gt; 
                  &lt;input type="text" [(ngModel)]="item.UserName" class="form-control" required #UserName="ngModel" name="UserName"/&gt;
  
                  &lt;span class="text-danger" *ngIf="(UserName.errors != null &amp;&amp; UserName.errors.required &amp;&amp; (UserName.dirty))"&gt;
                      Please enter user name.
                  &lt;/span&gt;
                &lt;/span&gt;                 
            &lt;/template&gt;
       &lt;/data-table-column&gt;
       &lt;data-table-column [header]="'Action'" &gt;
          &lt;template #dataTableCell let-item="item"&gt;                                       
             &lt;a title="Save" (click)="save(item)" class="btn green btn-sm"&gt;                                           
             &lt;/a&gt;                                        
           &lt;/template&gt;
       &lt;/data-table-column&gt;
  
     &lt;/data-table&gt;
  </code></pre>
  
  <p>Any help will be appreciable.</p>