欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

angularjs的select使用及默認(rèn)選中設(shè)置

 更新時(shí)間:2017年04月08日 15:45:46   作者:stoneuu  
本篇文章主要介紹了angularjs的select使用及默認(rèn)選中設(shè)置,非常具有實(shí)用價(jià)值,需要的朋友可以參考下

我最近在研究angularjs學(xué)習(xí)的道路上,那么今天也算個(gè)學(xué)習(xí)筆記吧!

1 ng-model="standardCourse.showHours"代替name

2 ng-selected = "1"代替selected="selected",但問題是select下會(huì)多出一個(gè)無用的option

3 在數(shù)據(jù)準(zhǔn)備時(shí)設(shè)置,$scope.standardCourse.showHours= '1';

解決多出的一個(gè)無用的option

<label for="_sel_show_hours">是否顯示課時(shí)數(shù)</label>

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

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

<option value="0">不顯示</option>
</select> 

radio也是 ng-checked="1",也需要準(zhǔn)備數(shù)據(jù)時(shí)設(shè)置默認(rèn)值

準(zhǔn)備數(shù)據(jù)參考

$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';
      }); 

以上就是本文的全部內(nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論