0
我使用select2的引导程序来搜索下拉菜单,但问题是验证不起作用。以前它在没有select2的情况下工作,但现在它不工作,并且总是显示消息。AngularJS ng-show上的验证在添加select2时不起作用
<div class="form-group" ng-class="{ 'has-error' : addEmployee.formAdd.pos.$invalid && !addEmployee.formAdd.pos.$pristine }">
<label>Position</label>
<select name="pos" id="pos" ng-model="addEmployee.employee.employee_positionID" class="form-control select2" required>
<option ng-repeat="option in addEmployee.position" value="{{option.position_id}}">{{option.position_name}}</option>
</select>
<p ng-show="addEmployee.formAdd.pos.$invalid && addEmployee.formAdd.pos.$dirty && addEmployee.formAdd.pos.$touched && addEmployee.formAdd.pos.$error.required" class="help-block">Position is required.</p>
</div>
我想,你的
@Natiq你是什么意思与空值?请详细说明 –
在ng-repeat之前加上以下行: – Natiq