title: angular 2 get FormControl in template as local variable
body: <p>I use in angular 2 model driven forms,when the user leaves the input element i want update data in server immediately (autosave).</p>
  
  <p>So, my solution is use the <code>(blur)</code> event and pass the form control to a function, then check the <code>dirty</code> property if is true, then update the server.</p>
  
  <p>How can I do this?</p>
  
  <p>Thanks in advance</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code> &lt;input type="text"
   formControlName="firstName"
   [(ngModel)]="contact.firstName"
   #ctrl=[currentFormControl]
   (blur)="onBlur(ctrl)"
                      /&gt;</code></pre>
  </div>
  </div>
  
  frm.component.ts:</p>
  
  <pre class="lang-js prettyprint-override"><code>  onBlur(formControl: FormControl){
  
        if(formControl.dirty){
            //update server
            formControl.reset();
        }
  
    }
  </code></pre>