国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

angularjs的select使用及默認選中設置

2024-05-06 15:18:41
字體:
來源:轉載
供稿:網友

我最近在研究angularjs學習的道路上,那么今天也算個學習筆記吧!

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

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

3 在數據準備時設置,$scope.standardCourse.showHours= '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> 

radio也是 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';      }); 

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持錯新站長站。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 桐城市| 南充市| 武邑县| 蓬安县| 乌拉特后旗| 多伦县| 玉林市| 湖州市| 缙云县| 腾冲县| 射阳县| 衡阳市| 屏边| 蚌埠市| 馆陶县| 和林格尔县| 洱源县| 墨玉县| 噶尔县| 青神县| 闵行区| 阿拉善盟| 灵川县| 金溪县| 芮城县| 甘洛县| 台安县| 山阳县| 呼伦贝尔市| 城步| 临沂市| 盐津县| 珠海市| 威信县| 濮阳市| 旌德县| 岳池县| 尼木县| 宁波市| 清苑县| 仙居县|