ng-option에 기본값을 추가하려고하지만이를 수행 할 수 없습니다. 다음은 내 코드 각도 필터를 사용하여 드롭 다운의 기본값을 선택할 수 없습니다.
var app = angular.module('jobs',[]).constant('API_URL', 'http://localhost:8000/');
app.controller('jobsController', function($scope, $http, API_URL, $timeout){
$scope.selectedItem = "Years";
console.log("hihi");
});
angular.module('jobs').filter("minmax", function(){
return function(arr, min, max){
min = parseInt(min);
max = parseInt(max);
for(var i =min; i <= max; i++){
arr.push(i);
}
return arr;
};
});
<div class="m-banner-1" ng-controller="jobsController">
<select class="ui fluid normal dropdown" data-ng-model="selectedItem"
ng-options="opt as opt for opt in [] | minmax:0:30">
</select>
</div>
여기 a link의
입니다!내가
당신은 수동으로 빈 기본 옵션을 추가 할 필요가
그건 의미가 없습니다. 선택한 옵션에는 숫자가 포함됩니다. "연도"는 숫자가 아니며 옵션이 아니기 때문에 선택할 수 없습니다. 그리고 $ scope.selectedItem을 선택으로하고 싶다면 ng-model은'ng-model = "selectedItem"'이어야합니다. 'ng-model = "proofGroupId"가 아닙니다. 너는 실제로 무엇을 원합니까? 상단에 기본 옵션이 "연도"로 표시된 숫자를 표시하는 선택 상자가 필요합니까? –
예 정확하게 "Years"를 보여주는 상단에 기본 옵션이있는 숫자를 표시하는 선택 상자가 있습니다 –