select如何在angularjs中使用

這篇文章將為大家詳細(xì)講解有關(guān)select如何在angularjs中使用,文章內(nèi)容質(zhì)量較高,因此小編分享給大家做個(gè)參考,希望大家閱讀完這篇文章后對相關(guān)知識有一定的了解。

創(chuàng)新互聯(lián)主營涪城網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營網(wǎng)站建設(shè)方案,app開發(fā)定制,涪城h5成都小程序開發(fā)搭建,涪城網(wǎng)站營銷推廣歡迎涪城等地區(qū)企業(yè)咨詢

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

2 ng-selected = "1"代替selected="selected",但問題是select下會多出一個(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';
      });

關(guān)于select如何在angularjs中使用就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,可以學(xué)到更多知識。如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到。

文章標(biāo)題:select如何在angularjs中使用
本文地址:http://muchs.cn/article6/ijosog.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供面包屑導(dǎo)航、網(wǎng)站策劃、網(wǎng)站收錄、靜態(tài)網(wǎng)站做網(wǎng)站、網(wǎng)站內(nèi)鏈

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站托管運(yùn)營