title: Get validators present in FormGroup/FormControl
body: <p>I'm using Material 2 in my app, but in this question I want to solve a problem specifically with <a href="https://material.angular.io/components/component/input" rel="noreferrer"><strong>Input</strong></a>.</p>
  
  <p>As you can see in <strong>API Reference</strong> there's a property bind called <code>required</code>, which shows as asterisk in the placeholder.</p>
  
  <p>So, I'm wondering if there's a way to check if the form control has an specific validator in <em>Angular</em>, because I really don't want to set manually for each input <code>[required]="true/false"</code></p>
  
  <p>I read the <a href="https://angular.io/docs/ts/latest/api/forms/index/AbstractControl-class.html" rel="noreferrer"><strong>AbstractControl</strong></a> docs and I didn't find anything about it. I've encountered the <code>hasError</code> <em>method</em> (which <strong>ironically</strong> isn't documented in <strong>nowhere</strong> ... neither in FormGroup nor in FormControl nor in AbstractControl), however this is not what I'm looking for. It just checks if the form control has the error, but as you may have read, I want to check if the control has some specific validators...</p>
  
  <p>Some code:</p>
  
  <pre><code>&lt;md-input-container&gt;
    &lt;input placeholder="Placeholder" 
           mdInput [formControl]="anyCtrl" 
           [required]="anyCtrl.hasValidator('required')"&gt; &lt;!-- something like this --&gt;
  &lt;/md-input-container&gt;
  </code></pre>
  
  <p>I hope the question is clear enough. Thanks in advance.</p>