Edit: Massively simplified to get to the core of the problem
In Angular (v1.2.22) validation, if the value of max depends on another value, and that value updates, the validation state does not automatically update.
var app = angular.module('app',[]).
controller('TestCtrl', function($scope){
$scope.partWidth = 10;
});
HTML:
<form name="itemForm">
<label for="partWidth">Part width</label>
<input id="partWidth" name="partWidth" min="10" max="180" ng-model="partWidth" placeholder="mm" required type="number">
<label for="cutterwidth">Cutter width</label>
<input id="cutterwidth" name="cutterwidth" min="10" max="{{ partWidth }}" ng-model="cutterwidth" placeholder="mm" required type="number">
</form>
Updated Plunker http://plnkr.co/edit/lNemYyFrHF9gyRgY8KIT
The ng-invalid class is not removed unless the cutterwidth itself is edited.
a) Is this a bug?
b) Is there a workaround? (e.g. force validation to run, somehow trigger the input event etc)
max=""attribute ofcutterwidthin the rendered page it DOES update live as the value of partwidth is changed. However Angular only removes theng-invalidclass when the cutterwidth itself is edited, this is not triggered when the value ofmaxchanges. Is this a bug?