Angular 2: Update FormControl validator after valueChanges
<p>Is there a way to update the <code>Validtors</code> of a FormControl Object? I have <code>FormGroup</code> where one Input is a select field, when the value of the select field changes I want the other FormControl in my FormGroup to change the validator. </p>

<p>Here is my <code>subscribeToFormChanges()</code> method from my FormGroup component:</p>

<pre><code>private appIdRegexes = {
    ios: /^[a-zA-Z][a-zA-Z0-9]*(\.[a-zA-Z0-9\-]+){2,}$/,
    android: /^([a-zA-Z])[a-zA-Z0-9_]*(\.[a-zA-Z][a-zA-Z0-9\-]*){2,}$/,
    any: /^any$/
  };

private subscribeToFormChanges(): void {
    const myFormValueChanges$ = this.appsForm.valueChanges;
    myFormValueChanges$.subscribe(x =&gt; {
      const platform = this.appsForm.controls['platform'].value;
      const appId = this.appsForm.controls['appId'].value;

      if (this.appIdRegexes[platform]) {
        this.appsForm.controls['appId'] = new FormControl(appId, Validators.pattern(this.appIdRegexes[platform].source));
      }
    });
  }
</code></pre>

<p>And here's the html template:</p>

<pre><code>&lt;div class="row" [formGroup]="appsForm"&gt;
  &lt;div class="form-group col-xs-6"&gt;
    &lt;label&gt;Platform&lt;/label&gt;

    &lt;select id="licensePlatform" class="form-control"
            formControlName="platform"&gt;
      &lt;option *ngFor="let platform of licensePlatforms" [value]="platform"&gt;
        {{platform}}
      &lt;/option&gt;
    &lt;/select&gt;

    &lt;small [hidden]="appsForm.controls.platform.valid"&gt;
      Platform is required
    &lt;/small&gt;
  &lt;/div&gt;

  &lt;div class="form-goup col-xs-6"&gt;
    &lt;label&gt;App ID&lt;/label&gt;
    &lt;input type="text" class="form-control" formControlName="appId"&gt;
    &lt;small [hidden]="appsForm.controls.appId.valid"&gt;
      Please use the right ID format
    &lt;/small&gt;
  &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>When I'm implementing the <code>subscribeToFormChanges()</code> method like shown here, <code>appsForm.controls.appId.value</code> doesn't update anymore when writing into the input field. Initially the value is updating.</p>