为什么AngularJS在SELECT中包含一个空选项?
select.span9(ng-model='form.type', required, ng-options='option.value as option.name for option in typeOptions');
$scope.typeOptions = [ { name: 'Feature', value: 'feature' }, { name: 'Bug', value: 'bug' }, { name: 'Enhancement', value: 'enhancement' }];
<select ng-model="form.type" required="required" ng-options="option.value as option.name for option in typeOptions" class="span9 ng-pristine ng-invalid ng-invalid-required"> <option value="?" selected="selected"></option> <option value="0">Feature</option> <option value="1">Bug</option> <option value="2">Enhancement</option></select>
相关分类