Javascript 具有最小/最大参数的验证编号
有两个字段。我需要一个比第二个小,第二个比第一个大,同时通过验证 但是,当输入第一个数字时,它不会保存在保存为未定义的模型中,因为无法通过验证条件max 对我来说重要的是键盘输入而不是按钮 有人能帮我解决这个问题吗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
<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。在你的例子中,你有这个问题。对我来说重要的是键盘输入而不是按钮