나는 전망이있다
<select ng-model="selected_student" class="form-control">
<option ng-repeat="obj in students" value="{{obj.id}}">{{obj.name}}</option>
</select>
나는 이것을하고있다 controller
:
$scope.selected_student = $scope.students[0];
왜 작동하지 않습니까?
여기 내 바이올린
시도해보십시오 ng-options
:
<select ng-model="selected_student" class="form-control" ng-options="student.id as student.name for student in students">
그리고 controller
:
$scope.selected_student = $scope.students[0].id;
jsfiddle 링크 작동 :
https://jsfiddle.net/avnesh2/boye4ezk/
당신을 위해 일할 것입니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다