title: How to do customer text field validation in angular2 using type script
body: <p>currently i am learning angular2 with validation part,I am not able to validate simple customer text box field</p>
  
  <p>Here is my HTML Code</p>
  
  <pre><code>&lt;div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 padding-lft-rght-0"&gt;
                          &lt;div class="form-control setup-form margin-btm"&gt;
                              &lt;label test_id="lblcustname" class="control-label col-xs-12 col-sm-4 col-md-4 col-lg-3" for=""&gt;
                                  {{ 'CUSTOMER.CNAME' | translate }} &lt;span class="mandatory"&gt;*&lt;/span&gt;
                              &lt;/label&gt;
                              &lt;div class="col-xs-12 col-sm-8 col-md-8 col-lg-8 padding-left-0"&gt;
                                  &lt;input type="text" id="txtName" class="form-control" required maxlength="100" name="CustomerName" [(ngModel)]="customerObj.CustomerName" (ngModelChange)="checkCustomeName($event)" /&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
  </code></pre>
  
  <p>and below my Typescript code</p>
  
  <pre><code>checkCustomeName(event) {
  
          if (event === "") {
              this.isCustomerNameEmpty = false;
          }
          else {
              var textbox= document.getElementById('txtName');
              if (textbox.nodeValue.length &gt; 100)
              {
                  this.isCustomerNameexceed = false;
              }
              this.isCustomerNameexceed = true;
  
  
          }
      }
  </code></pre>
  
  <p>So whenever i am debugging using chrome i am not able to get any value in below line..</p>
  
  <pre><code>var textbox= document.getElementById('txtName');
  </code></pre>
  
  <p>So is this the correct way to do validation in typescript.</p>