1.引入文件

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

2.页面

angularjs-select2的使用


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'];//赋值
 

 

相关文章:

  • 2022-12-23
  • 2021-06-10
  • 2022-02-06
  • 2022-12-23
  • 2022-01-26
  • 2022-12-23
  • 2021-06-25
猜你喜欢
  • 2021-12-19
  • 2021-08-28
  • 2021-08-25
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案