angularjs select optgroup

前端之家收集整理的这篇文章主要介绍了angularjs select optgroup前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

HTML:

<div ng-app="app">
 <div ng-controller="ParentCtrl">
     <select ng-model="tipost" 
        ng-options="tip.DESC group by tip.TIPIS for tip in tipall"><br>
</select>
 </div>

JS:

angular.module('app',[])

function ParentCtrl($scope){
       $scope.tipall = [
             {"ID":"1","TIPIS":"GroupName1","DESC":"name"},{"ID":"2","DESC":"name1"},{"ID":"3","TIPIS":"GroupName2","DESC":"name2"},{"ID":"4","DESC":"name3"},];
}

效果演示:http://jsfiddle.net/rtCP3/182/

原文链接:https://www.f2er.com/angularjs/145927.html

猜你在找的Angularjs相关文章