title: Angular 2 Form Validation For Numbers minimum and maximum
body: <p>I have a form with input boxes. The input boxes are in both type text and numbers. And I have to validate them and I followed this <a href="https://scotch.io/tutorials/angular-2-form-validation" rel="noreferrer">tutorial</a> and tried to validate them.</p>
  <p>According to that if I have to validate a string then I can use the control group as follows.</p>
  <pre><code>constructor(fb: FormBuilder){
      this.complexForm = fb.group({
        'firstName' : [null, Validators.required],
        'lastName': [null, Validators.compose([Validators.required, Validators.minLength(5), Validators.maxLength(10)])]
  })
  </code></pre>
  <p>And the HTML code for this as follows...</p>
  <pre><code>&lt;form [formGroup]=&quot;complexForm&quot; (ngSubmit)=&quot;submitForm(complexForm.value)&quot;&gt;
        &lt;div class=&quot;form-group&quot;&gt;
          &lt;label&gt;First Name:&lt;/label&gt;
          &lt;input class=&quot;form-control&quot; type=&quot;text&quot; placeholder=&quot;John&quot; [formControl]=&quot;complexForm.controls['firstName']&quot;&gt;
        &lt;/div&gt;
        &lt;div class=&quot;form-group&quot;&gt;
          &lt;label&gt;Last Name&lt;/label&gt;
          &lt;input class=&quot;form-control&quot; type=&quot;text&quot; placeholder=&quot;Doe&quot; [formControl]=&quot;complexForm.controls['lastName']&quot;&gt;
        &lt;/div&gt;
        &lt;div class=&quot;form-group&quot;&gt;
          &lt;button type=&quot;submit&quot; class=&quot;btn btn-default&quot;&gt;Submit&lt;/button&gt;
        &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  <p>But I have to validate a number type input box also as the following example.</p>
  <pre><code>&lt;form [formGroup]=&quot;complexForm&quot; (ngSubmit)=&quot;submitForm(complexForm.value)&quot;&gt;
            &lt;div class=&quot;form-group&quot;&gt;
              &lt;label&gt;Age:&lt;/label&gt;
              &lt;input class=&quot;form-control&quot; type=&quot;number&quot;  [formControl]=&quot;complexForm.controls['age']&quot;&gt;
            &lt;/div&gt;
            &lt;div class=&quot;form-group&quot;&gt;
              &lt;button type=&quot;submit&quot; class=&quot;btn btn-default&quot;&gt;Submit&lt;/button&gt;
            &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  <p>But Problem is there is no option for Validators to select what is minimum value and maximum value for the input.</p>
  <p>are there someone has a solution for this issue?</p>
  <p>Thanks.</p>