Check if input control has certain type of vallidator in angular2
<p>I have component that wraps input field. In the component i receive the <code>Control</code> object from <code>@Input() inputControl: Control;</code>. In the template i have span that shows message if input field in the component is not required.</p>

<pre><code>&lt;span
  class="input-label-caption"&gt;
  (optional)
&lt;/span&gt;
</code></pre>

<p>and the input</p>

<pre><code>&lt;input
    *ngIf="inputMode=='text' || inputMode=='email'"
    type="{{inputMode}}"
    [ngFormControl]="inputControl"
    placeholder="{{placeholder}}"
    class="input-text"
    [disabled]="inputDisabled"
    [ngClass]="{
    'inverted': inverted
    }"&gt;
</code></pre>

<p>How can i read form <code>inputControl</code> object if it contains <code>Validators.required</code>?
I want to know if i can used it like this for example</p>

<pre><code>&lt;span
  class="input-label-caption"
  *ngIf="!inputControl.validators.required"
  &gt;
  (optional)
&lt;/span&gt;
</code></pre>