title: How do you validate a FormBuilder control based on another in Angular2?
body: <p>I'm using FormBuilder in Angular2 and I created a custom validator service.</p>
  
  <p><strong>Component</strong> </p>
  
  <pre><code>this.exampleForm  = this.formBuilder.group({
      'FirstName': ['', Validators.required],
      'LastName': ['', [Validators.required]],
      'Description': [''],
      'Location': [''],
  });
  
  this.exampleForm .addControl("StartDate", this.formBuilder.group({
      'Month': [0, [Validators.required, ValidationService.monthValidator]],
      'Year': [0, [Validators.required, ValidationService.yearValidator]]
  }));
  
  this.exampleForm .addControl("EndDate", this.formBuilder.group({
      'Month': [0],
      'Year': [0]
  }));
  </code></pre>
  
  <p><strong>HTML component</strong></p>
  
  <pre><code>&lt;div formGroupName="StartDate"&gt;
      &lt;select formControlName="Month"&gt;
          &lt;option&gt;...&lt;/option&gt;
          &lt;/option&gt;
      &lt;/select&gt;
      &lt;select formControlName="Year"&gt;
          &lt;option&gt;...&lt;/option&gt;
      &lt;/select&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I don't want to have an earlier EndDate than StartDate</p>
  
  <p>How do I validate EndDate control based on StarDate control?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Tried something like this: </p>
  
  <pre><code>this.exampleForm  = this.formBuilder.group({
          ...
      }, passwordMatchValidator);
  
  function passwordMatchValidator(g: FormGroup) {
     return g.get('FirstName').value === g.get('LastName').value
        ? null : {'mismatch': true};
  }
  </code></pre>
  
  <p>It doesn't do anythig</p>