title: AngularJs : Set conditional min and max value for validation in number input field
body: <p>I have created a web page which contains a form with two number input fields <code>field1</code> and <code>field2</code>. I'm doing the validation on these fields. <code>field1</code> has a <code>min</code> value 1 and <code>max</code> value 100000 but <code>field2</code> should have <code>min</code> value is <code>max</code> of <code>field1</code> or 1, anything which is greater and <code>max</code> is 100000. I tried to assign the <code>ng-model</code> of <code>field1</code> as <code>min</code> of <code>field2</code> but it not working.</p>
  
  <pre><code>&lt;div class="row"&gt;
    &lt;div&gt;
      &lt;input ng-model="priceminrange" name="priceminrange" type="number"
      class="form-control" value="" placeholder="MinRange" min="1" max="100000"&gt;
      &lt;span ng-show="form.priceminrange.$error.number"&gt;The value is not a valid number&lt;/span&gt; 
      &lt;span ng-show="form.priceminrange.$error.min || form.priceminrange.$error.max"&gt;
      The value must be in range 1 to 100000&lt;/span&gt;
    &lt;/div&gt;
    &lt;div&gt;
      &lt;input ng-model="pricemaxrange" name="pricemaxrange" type="number"
      class="form-control" value="" placeholder="MaxRange" min={{priceminrange}} max="100000"&gt;
      &lt;span ng-show="form.pricemaxrange.$error.number"&gt;The value is not a valid number&lt;/span&gt; 
      &lt;span ng-show="form.pricemaxrange.$error.min || form.pricemaxrange.$error.max"&gt;
      The value must be in range {{priceminrange}} to 100000&lt;/span&gt;
      form.pricemaxrange.$error = {{form.pricemaxrange.$error}}
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>