以下是我的代码片段。我想使用 Angular 验证我的下拉菜单。
<td align="left" width="52%">
<span class="requiredSmall">*</span>
<select class="Sitedropdown" style="width: 220px;"
ng-model="selectedSpecimen().serviceID"
ng-options="service.ServiceID as service.ServiceName for service in services">
<option value="" ng-selected="selected">Select Service</option>
</select>
</td>
有效的意思:
有效值可以是“选择服务”以外的任何值,这是我的默认值。与其他 ASP.net 一样,下拉列表需要字段验证器 DefaultValue="0",所以这里我的下拉列表将从服务中绑定,我想选择除“选择服务”之外的所有其他值。