title: How do I validate form input against a max value pulled from a model?
body: <p>I have this form:</p>
  
  <pre><code>&lt;div ng-repeat="item in ctrl.cartItems"&gt;
      &lt;div class="col-sm-4 cartItemLabel" ng-bind-html="item.label"&gt;  &lt;/div&gt;
      &lt;div class="col-sm-2 inputItem"&gt;
           &lt;input class="form-control input" type="text" id="item.id" name="item.id" ng-change="ctrl.updateSub(item)" ng-model="item.qty" max="item.maxqty"&gt;
     &lt;/div&gt;
     &lt;div class="col-sm-1 inputItemValue"&gt;
         &lt;span ng-bind="item.maxqty"&gt;&lt;/span&gt;
     &lt;/div&gt;
     &lt;div class="col-sm-2 inputItemValue"&gt;
         &lt;span ng-bind="item.value | currency:USD$:2"&gt;&lt;/span&gt;
     &lt;/div&gt;
     &lt;div class="col-sm-1 inputItemValue"&gt;
         $
     &lt;/div&gt;
     &lt;div class="col-sm-2 inputItem"&gt;
         &lt;input class="form-control" type="text" id="item.id" name="item.id" ng-model="item.subTotal"&gt;
     &lt;/div&gt;
     &lt;div class="col-sm-4"&gt;&lt;/div&gt;
     &lt;div class="col-sm-2 error" ng-show="form.item.id.$invalid"&gt;
       &lt;small class="error" ng-show="form.item.id.$error.max"&gt;
          You exceeded the maximum allowed
       &lt;/small&gt;
     &lt;/div&gt;
   &lt;/div&gt;
  </code></pre>
  
  <p>The value for max is set to item.maxqty, which is pulled from JSON in my model. All values are populated correctly. I just can't seem to get the validation to work. Any ideas? The important bit of the code is deep in the bushes :) So, here is the line I need to validate:</p>
  
  <pre><code>&lt;input class="form-control input" type="text" id="item.id" name="item.id" ng-change="ctrl.updateSub(item)" ng-model="item.qty" max="item.maxqty"&gt;
  </code></pre>