title: Angular2: Conditional required validation
body: <p>I am trying to create a conditional required validation on a specific field.I try doing this by return Validators.required back in my function, but this doesn't seem to work. How do I go about doing this? Here's my code:</p>
  
  <pre><code>private _ansat: AbstractControl = new FormControl('', Validators.required);
  private _helbred: AbstractControl = new FormControl('', Validators.compose([this.useValidateIfRadio(this._ansat, 0, Validators.required)]) );
  
  
  constructor(private _fb: FormBuilder) {
      this.myForm = this._fb.group({
              ansat: this._ansat,
              helbred: this._helbred
          });
  }
  
  useValidateIfRadio (c: AbstractControl, n: number, v) {
          return function (control) {
              return new Promise(resolve =&gt; {
               // this.msg = ansatControl.value;
               console.log(v);
                  if (c.value === n) {
  
                      resolve(v);
                  }
                  else {
                    resolve(null);
  
                  }
              });
          };
      };
  </code></pre>
  
  <p>Any help is greatly appreciated.</p>