Angularjs-select2: n käyttö

Use Angularjs Select2



1. Asiakirjojen esittely

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

2. Sivu





3.html



class='form-control' ng-model='modelName' s2-options='item.value as item.name for item in dataList' multiple='multiple' placeholder='-please choose-'> //dataList is the data requested from the interface, modelName is the multi-selected variable value

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 //value }else{ //... } }).error(function(){}) } $scope.getSelectDataList() 
$scope.dataList=['11111','101920']//Assignment
 

Painettu uudelleen: https://www.cnblogs.com/cynthia-wuqian/p/7054120.html