整数列的必需属性和默认0值

时间:2018-12-26 23:11:55

标签: html angularjs validation

我具有以下选择控件:

<select class="form-control"
                        ng-model="crud.model.type"
                        name="batchType"
                        required
                        ng-disabled="crud.model.status===3"
                        ng-options="t.id as t.descrip for t in crud.metaData.batchTypes">
                    <option value=""> @String.Format(Labels.selectX, Labels.batchType)</option>
                </select>

Type是一个整数列。尝试创建新批次时,我希望看到控件以红色突出显示,并且在选择实际值之前,不允许保存信息。

不幸的是,它似乎不起作用。默认值为0使其不再需要。

处理问题的最佳方法是什么?

更新。我针对特定情况解决了该问题,但仍然对某些通用解决方案感兴趣。

0 个答案:

没有答案