title: Check present validators inside custom reactive from component
body: <p>Inside one of my form components, say <code>MyParentFormComponent</code>, I need to know which validators are used by its parent component For example</p>
  
  <pre><code>const fc = new FormControl('', [Validators.email, Validators.required]);
  </code></pre>
  
  <p>So, in my form control component I would like to know that these two validators are present. The reason why is that this custom from component is a wrapper around other form components, so I would like to pass these validators on to its children.</p>
  
  <p>So, I have tried:</p>
  
  <pre><code>export MyParentFormComponent implements OnInit, ControlValueAccessor {
      @Input() formControlName: string;
  
      constructor(@Optional() private controlContainer: ControlContainer) {}
  
      ngOnInit(): void {
          const control = this.controlContainer.control.get(formFieldName);
          const validators = control.validator(''); // problems!!!
      }
  }
  </code></pre>
  
  <p><a href="https://stackblitz.com/edit/angular-ivy-6dmn2c?file=src%2Fapp%2Fmy-custom-form-control%2Fmy-custom-form-control.component.ts" rel="nofollow noreferrer">DEMO</a></p>
  
  <p>First, the <code>control.validator</code> function does not expects a string, in my IDE I get the following message:</p>
  
  <p><a href="https://i.stack.imgur.com/d3Li7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/d3Li7.png" alt="enter image description here"></a> </p>
  
  <p>Apparently it would like an AbstractControl. But when I fix this error as follows</p>
  
  <pre><code>control.validator('' as any);
  </code></pre>
  
  <p>it returns</p>
  
  <pre><code>{ required: true }
  </code></pre>
  
  <p>it only contains the <code>Validators.required</code>. All others are not in there. </p>
  
  <p>So I get the feeling that this might not be the right path to obtain the validators information. Any suggestion how I can get this list? </p>
  
  <p>UPDATE: <code>control.validator</code> is not a property but a function</p>
  
  <p><a href="https://i.stack.imgur.com/sBjGc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sBjGc.png" alt="enter image description here"></a></p>