Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/435.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 具有最小/最大参数的验证编号_Javascript_Angularjs - Fatal编程技术网

Javascript 具有最小/最大参数的验证编号

Javascript 具有最小/最大参数的验证编号,javascript,angularjs,Javascript,Angularjs,有两个字段。我需要一个比第二个小,第二个比第一个大,同时通过验证 但是,当输入第一个数字时,它不会保存在保存为未定义的模型中,因为无法通过验证条件max 对我来说重要的是键盘输入而不是按钮 有人能帮我解决这个问题吗 <td><input type="number" class="form-control input-sm" ng-model="item.low" max="{{item.high-1}}" required></td> <td>&l

有两个字段。我需要一个比第二个小,第二个比第一个大,同时通过验证

但是,当输入第一个数字时,它不会保存在保存为未定义的模型中,因为无法通过验证条件max

对我来说重要的是键盘输入而不是按钮

有人能帮我解决这个问题吗

<td><input type="number" class="form-control input-sm" ng-model="item.low" max="{{item.high-1}}" required></td>
<td><input type="number" class="form-control input-sm" ng-model="item.high" min="{{item.low+1}}" required></td>

您是否尝试在控制器中初始化item.low和item.high的值

item.high={{item.high}

item.low={{item.low}


这比我想象的要容易

我刚在第一次输入中删除了对max的测试,他是不必要的 验证成功,数据正确

<td><input type="number" class="form-control input-sm" ng-model="item.low" required></td>
<td><input type="number" class="form-control input-sm" ng-model="item.high"  min="{{item.low+1}}" required></td>

ty all for help

是,我设置为低0和高1。在你的例子中,你有这个问题。对我来说重要的是键盘输入而不是按钮