title: Angular: Refer to current element in a template
body: <p>I have a form with several inputs. I want to validate each one separately, and add a class (for example, <code>is-invalid</code>) when the input contains an invalid value. I know Angular adds <code>ng-invalid</code> to the input class list, but as Bootstrap needs another class to show the error, I would like to add Bootstrap's class.</p>
  
  <p>Is there any way to refer to the current element in Angular? I'm using Angular 5. My template:</p>
  
  <pre><code>&lt;input [(ngModel)]="test" name="test" required [class.is-invalid]="thisElement.invalid &amp;&amp; thisElement.touched"&gt;
                                                                     ^^^^^^^^^^^
  </code></pre>
  
  <p>Something to refer to the current element (<code>thisElement</code> in the snippet) is what I'm looking for. Does it exist?</p>