title: How to add validation in template driven form from component in angular 6
body: <p>In angular 6, We have two approaches to create the form.</p>
  
  <ol>
  <li>Model-driven</li>
  <li>Template-driven</li>
  </ol>
  
  <p>In the model-driven approach, we defined the validators via code in the component. And
  In the template-driven approach, we define the validators via directives and HTML5 attributes in our template itself. </p>
  
  <p>Is there any approach, In the template-driven form, We can define the validation from component code. </p>
  
  <p>I need to define and change the validation of a text box from component code on some input test change.</p>
  
  <pre><code>&lt;input type="text" [(ngModel)]="value" (input)="ValueChangeEvent(myvalue)" /&gt; 
  </code></pre>
  
  <p>Here, in the <code>ValueChangeEvent</code> method, I need to change the validation of my textbox.(For example, when user type something, then only I need to add the minimum value validation in the text box. )</p>