angularjs-select2的使用


1.引入文件

 '/select2.css',
 '/select2-bootstrap.css',
 '/select2.min.js',
‘/angular-select2.min.js’

2.页面

 

3.html

<select2 class="form-control" ng-model="modelName" s2-options="item.value as item.name for item in dataList" multiple="multiple" placeholder="-请选择-"></select2> //dataList是从接口请求来的数据 , modelName是多选的变量值

4.js

 $scope.getSelectDataList = function () {
            var url = "/xxx/xxxx.do";
            $http.get(url).success(function(res){
                if(res.code==1){
                    $scope.dataList = res.data.dataList; //取值
                }else{
                   //...
                };
            }).error(function(){});
        };
        $scope.getSelectDataList();
$scope.dataList=['11111','101920'];//赋值
 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM