ng-invalid无法处理select标签 - AngularJS

时间:2016-02-22 12:03:01

标签: javascript html css angularjs

我尝试了以下代码:

HTML

<select id="selectReason" name="selectReason" class="form-control" ng-options="reason as reason.reasonName for reason in dataCtrl.data.reasons" ng-model="table.reason" ng-required="table.needReason" ng-show="table.needReason">                              </select>

CSS

.ng-invalid.ng-dirty {
border-color: #FA787E;

}

OUTPUT标签

<select id="selectReason" name="selectReason" class="form-control ng-pristine ng-empty ng-invalid ng-invalid-required ng-touched" ng-options="reason as reason.reasonName for reason in dataCtrl.data.reasons" ng-model="table.reason" ng-required="table.needReason" ng-show="table.needReason" required="required"><option value="" class="" selected="selected">
</option><option label="No Material" value="object:18">No Material</option>
<option label="Machine Breakdown" value="object:19">Machine Breakdown</option>
</select>

后来我还添加了ng-invalid css。

我点击提交时,select标签会在其class属性中获取“ng-invalid”类,但不会显示红色边框

请帮我解决这个问题。

提前致谢:)

0 个答案:

没有答案