如何动态设置ng-dropdown-multiselect的设置选项,比如设置数据,这是可行的吗?
在这里查看: http://plnkr.co/edit/ntVBcGRsD0HXgQoshBlp?p=preview
视图
<div ng-dropdown-multiselect=""
options="example65data"
selected-model="example65model"
extra-settings="example65settings"></div>
控制器
$scope.example65model = [{id: 1}];
$scope.example65data = [{id: 1, label: "David"}, {id: 2, label: "Jhon"}];
$scope.example65settings = {selectionLimit: 3};
$scope.updateMultiSelectLimit = function (){
$scope.example65settings = {selectionLimit: 2};
}
$scope.updateData = function(){
$scope.example65data = [{id: 1, label: "Peter"}, {id: 2, label: "Yiss"}, {id: 3, label: "Max"}];
}
答案 0 :(得分:0)
function* excelToJSON(excelFileNames) {
var jsonData = [];
var count=0;
for (let index = 0; index < excelFileNames.length; index++) {
parseXlsx(excelFilesNames[index], function (err, data) {
jsonData.push(data);
console.log(jsonData); //***Shows data correctly
if(count==excelFileNames.length){
console.log(jsonData);
return yield jsonData;
}
count++
});
}
}
答案 1 :(得分:0)
尝试一下
//HTML
<div
ng-dropdown-multiselect=""
options="tabListdata"
selected-model="tabListmodel"
extra-settings="tabListsettings"
events="{ onSelectionChanged: getAllPolicies }"
>
</div>
//JS
$scope.tabListmodel = [];
$scope.tabListdata = [{
id: 1,
label: "Option 1"
}, {
id: 2,
label: "Option 2"
}, {
id: 3,
label: "Option 3"
}, {
id: 4,
label: "Option 4"
}, {
id: 5,
label: "Option 5"
}, {
id: 6,
label: "Option 6"
}];
$scope.tabListsettings = {
smartButtonMaxItems: 6,
smartButtonTextConverter: function (itemText, originalItem) {
return itemText;
}
};
$scope.getAllPolicies = function () {
console.log("$scope.tabListmodel", $scope.tabListmodel);
}