我无法使用AngularJS在下拉列表中设置值。我的代码如下:
<select id="lstFruits" multiple="multiple">
<option value=" ">Select Voucher Code</option>
<option value="{{c.value}}" ng-repeat="c in listOfCode">{{c.name}}</option>
</select>
$scope.listOfCode=[];
var code={'voucher_code_id':voucherid};
$http({
method:'POST',
url:"php/getVoucherNotifyCode.php",
data:code,
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).then(function successCallback(response){
//console.log('voucher code',response.data);
$scope.codeImage=response.data[0].image;
$scope.arrCode=response.data[0].generated_code.split(',');
for(var i=0;i<$scope.arrCode.length;i++){
var data={'name':$scope.arrCode[i],'value':$scope.arrCode[i]};
$scope.listOfCode.push(data);
}
console.log('list of code',$scope.listOfCode);
},function errorCallback(response) {
})
$('#lstFruits').multiselect({
includeSelectAllOption: true
});
这里我没有在下拉列表中获取所有值。