angularjs的select使用及默認(rèn)選中設(shè)置
我最近在研究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í)有所幫助,也希望大家多多支持腳本之家。
- AngularJS service之select下拉菜單效果
- AngularJS實(shí)現(xiàn)select的ng-options功能示例
- AngularJS Select(選擇框)使用詳解
- angularjs 實(shí)現(xiàn)帶查找篩選功能的select下拉框?qū)嵗?/a>
- Angularjs實(shí)現(xiàn)帶查找篩選功能的select下拉框示例代碼
- AngularJS基礎(chǔ) ng-selected 指令簡(jiǎn)單示例
- AngularJS入門教程之Select(選擇框)詳解
- AngularJS select設(shè)置默認(rèn)值的實(shí)現(xiàn)方法
相關(guān)文章
用angular實(shí)現(xiàn)多選按鈕的全選與反選實(shí)例代碼
本篇文章主要介紹了用angular實(shí)現(xiàn)多選按鈕的全選與反選實(shí)例代碼,非常具有實(shí)用價(jià)值,需要的朋友可以參考下2017-05-05Angular中的結(jié)構(gòu)指令模式及使用詳解
這篇文章主要為大家介紹了Angular中的結(jié)構(gòu)指令模式及使用示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-08-08AngularJS基礎(chǔ) ng-cloak 指令簡(jiǎn)單示例
本文主要介紹AngularJS ng-cloak 指令,這里幫大家整理了ng-clock指令的基礎(chǔ)資料,和簡(jiǎn)單的代碼實(shí)例及效果圖,學(xué)習(xí)AngularJS指令的朋友可以參考下2016-08-08分享使用AngularJS創(chuàng)建應(yīng)用的5個(gè)框架
如果你計(jì)劃使用AngularJS創(chuàng)建你的Web應(yīng)用,那現(xiàn)在就開始吧。你不需要有任何的恐懼和擔(dān)心,因?yàn)楝F(xiàn)在有很多的框架都可以很好地支持AngularJS2015-12-12AngularJS 支付倒計(jì)時(shí)功能實(shí)現(xiàn)思路
這篇文章主要介紹了AngularJS 支付倒計(jì)時(shí)功能的實(shí)現(xiàn)思路,需要的朋友可以參考下2017-06-06angularjs的select使用及默認(rèn)選中設(shè)置
本篇文章主要介紹了angularjs的select使用及默認(rèn)選中設(shè)置,非常具有實(shí)用價(jià)值,需要的朋友可以參考下2017-04-04淺析angularJS中的ui-router和ng-grid模塊
下面小編就為大家?guī)硪黄獪\析angularJS中的ui-router和ng-grid模塊。小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2016-05-05