• <fieldset id="8imwq"><menu id="8imwq"></menu></fieldset>
  • <bdo id="8imwq"><input id="8imwq"></input></bdo>
    最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
    問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
    當前位置: 首頁 - 科技 - 知識百科 - 正文

    angularjs select 賦值 ng-options配置方法

    來源:懂視網 責編:小采 時間:2020-11-27 22:18:24
    文檔

    angularjs select 賦值 ng-options配置方法

    angularjs select 賦值 ng-options配置方法:數組方式 數據是數組 $scope.years = [2014, 2015, 2016]; 頁面元素 <select ng-model=item ng-options=item as y for y in years> </select> 設置默認值 如果需要設置默認的選項,可以先設置一個參數: $scop
    推薦度:
    導讀angularjs select 賦值 ng-options配置方法:數組方式 數據是數組 $scope.years = [2014, 2015, 2016]; 頁面元素 <select ng-model=item ng-options=item as y for y in years> </select> 設置默認值 如果需要設置默認的選項,可以先設置一個參數: $scop

    數組方式

    數據是數組

    $scope.years = [2014, 2015, 2016];

    頁面元素

     <select ng-model="item" ng-options="item as y for y in years">
     </select>

    設置默認值

    如果需要設置默認的選項,可以先設置一個參數:

    $scope.item = 2016;
    $scope.years = [2014, 2015, 2016];

    對象數組方式

    數據是對象數組

    $scope.sites = [
     {site : "baidu", url : "https://www.baidu.com"},
     {site : "163", url : "http://www.163.com"},
     {site : "sina", url : "http://www.sina.com"}
    ];

    頁面元素

     <select ng-model="s.site" ng-options="s.site as s.site group by site.group for s in sites">
     </select>

    設置默認值

    如果需要設置默認的選項,可以先設置一個參數:

    $scope.site = "163";
    $scope.sites = [
     {site : "baidu", url : "https://www.baidu.com"},
     {site : "163", url : "http://www.163.com"},
     {site : "sina", url : "http://www.sina.com"}
    ];

    Key-Vules對象數組方式

    數據是對象數組

    $scope.cars = {
    car1 : {brand : "BYD", model : "Y50", color : "red"},
    car2 : {brand : "CC", model : "HF", color : "white"},
    car3 : {brand : "JL", model : "JL10D", color : "black"}
    };

    頁面元素

    <select ng-model="myCar" ng-options="y.brand for (x, y) in cars">
    </select>

    設置默認值

    如果需要設置默認的選項,可以先設置一個參數:

    $scope.site = "BYD";
    $scope.cars = {
    car1 : {brand : "BYD", model : "Y50", color : "red"},
    car2 : {brand : "CC", model : "HF", color : "white"},
    car3 : {brand : "JL", model : "JL10D", color : "black"}
    };

    angularjs ng-options官方API

    數組類型:

    label for value in array
    select as label for value in array
    label group by group for value in array
    select as label group by group for value in array track by trackexpr

    對象類型:

    label for (key , value) in object
    select as label for (key , value) in object
    label group by group for (key, value) in object
    select as label group by group for (key, value) in ob
    

    以上這篇angularjs select 賦值 ng-options配置方法就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

    聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

    文檔

    angularjs select 賦值 ng-options配置方法

    angularjs select 賦值 ng-options配置方法:數組方式 數據是數組 $scope.years = [2014, 2015, 2016]; 頁面元素 <select ng-model=item ng-options=item as y for y in years> </select> 設置默認值 如果需要設置默認的選項,可以先設置一個參數: $scop
    推薦度:
    標簽: 方法 select 賦值
    • 熱門焦點

    最新推薦

    猜你喜歡

    熱門推薦

    專題
    Top
    主站蜘蛛池模板: 97精品在线播放| 国产农村妇女毛片精品久久| 66精品综合久久久久久久| 最新精品亚洲成a人在线观看| 91精品国产人成网站| 精品无码久久久久久尤物| 日本精品少妇一区二区三区| 久久精品国产亚洲沈樵| 国产午夜精品一区二区三区漫画| 香蕉99久久国产综合精品宅男自| 成人精品一区二区三区在线观看 | 乱精品一区字幕二区| 韩国三级中文字幕hd久久精品| 亚洲精品你懂的| 99精品国产在热久久无毒不卡| 亚洲人成精品久久久久| 欧美激情精品久久久久久久九九九 | 在线亚洲欧美中文精品| 国产乱码精品一区二区三| 精品九九久久国内精品| 欧洲精品久久久av无码电影| 久久久精品国产Sm最大网站| 国产精品青草视频免费播放| 欧美精品1区2区| 久久精品草草草| 国产亚洲精品观看91在线| 国产精品久线在线观看| 久久精品夜夜夜夜夜久久| 中国精品18videosex性中国| 日本欧美国产精品第一页久久| 国产人成精品综合欧美成人| 99精品电影一区二区免费看| 欧美精品第一页| 99久久精品免费观看国产| 51久久夜色精品国产| 国产2021久久精品| 国产成人久久久精品二区三区| 2020最新久久久视精品爱| 亚洲精品欧美综合在线| 91久久精品电影| 国产免费久久精品丫丫|