title: How to access the Validator.required inside a custom component
body: <p>I need some help.  I'm trying to create a custom component that wraps a dropdown value and shows/hides the default --Select-- option depending upon whether it is required.  (And I want to apply other custom logic to this component later)  </p>
  
  <p>How do I get at the Validator.required within my custom control that is set via the reactive form of the parent??</p>
  
  <p>I'm new to Angular but not AngularJS</p>
  
  <p><em>Parent page html:</em></p>
  
  <pre><code>&lt;div formGroupName="siteType"&gt;
      &lt;my-dropdownlist 
          id="siteType"
          formControlName="code" 
          [items]="arrayOfItems"&gt;
      &lt;/my-dropdownlist&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><em>Parent page .ts:</em></p>
  
  <pre><code>export class MyPage {
  
  serviceForm: FormGroup = this.fb.group({
      siteType: this.fb.group({
          code: [serviceData.siteType, Validators.required]  
      })
  });
  </code></pre>
  
  <p><em>Custom control html:</em></p>
  
  <pre><code>&lt;select class="form-control" id="itemType"&gt;
      &lt;option *ngIf="!selectedValue &amp;&amp; required"&gt;--Select--&lt;/option&gt;
      &lt;option *ngFor="let item of items" [value]="item"&gt;
          {{ item }}
      &lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p><em>Custom control ts:</em></p>
  
  <pre><code>import { Component, Input, Output, EventEmitter, forwardRef, OnInit} from '@angular/core';
  import { NG_VALIDATORS, FormControl, Validator, NgForm, FormBuilder } from '@angular/forms';
  
  @Component({
      selector: 'my-dropdownlist',
      templateUrl: './dropdownlist.component.html',
      providers: [
          {
              provide: NG_VALIDATORS,
              useExisting: forwardRef(() =&gt; DropdownListComponent),
              multi: true
          }
      ]
  })
  export class MyDropdownListComponent implements Validator, OnInit {
      @Input() items: any[];
      @Input() required: boolean = false;
      @Input() formControlName: string;
      private selectedValue: any;
  
      ngOnInit() {
          //Some way to get at the Validator.required set on the parent form here so I can tell whether to apply it to my dropdown?
      }
      public validate(c: FormControl) {
          return null;  //TODO for additional future validation
      }
  }
  </code></pre>