angularjs 의 select 사용 및 기본 선택 설정

1503 단어 angularjsselect
저 는 최근 에 angularjs 공 부 를 연구 하 는 길에 있 습 니 다.그럼 오늘 도 학습 노트 로 하 겠 습 니 다!
1 ng-model="standard Course.show Hours"대체 name
2 ng-selected="1"대신 selected="selected",문 제 는 select 에서 쓸모없는 option 이 하나 더 생 긴 다 는 것 이다.
3.데이터 준비 시$scope.standard Course.show Hours='1'을 설정 합 니 다.
더 많은 것 을 해결 하 는 쓸모없는 option

<label for="_sel_show_hours">       </label>

<select id="sel_show_hours" ng-model="standardCourse.showHours" >

<option value="1" ng-selected = "1">  </option>

<option value="0">   </option>
</select> 
라디오 도 ng-checked="1"이 며,데 이 터 를 준비 할 때 기본 값 을 설정 합 니 다.
준비 데이터 참조

$stateProvider.state('home.standardCourseAdd', {

    url: "/standardCourse/add",

    templateUrl: "/partials/ace/standardCourse/add.html",

    controller: function ($rootScope, $http, $scope, $location, $anchorScroll, $stateParams, $state, $timeout, $compile, Upload) {

      fnPost($scope, $state, $http, {'name': ''}, '/standardCourse/toAdd.do', function (success, data) {

        $scope.standardCourse = data.entity;

        $scope.standardCourse.showHours= '1';
      }); 
이상 이 바로 본 고의 모든 내용 입 니 다.여러분 의 학습 에 도움 이 되 고 저 희 를 많이 응원 해 주 셨 으 면 좋 겠 습 니 다.

좋은 웹페이지 즐겨찾기