我正在使用" angular dropdown multiselect" 和on" onSelectAll"事件我想得到所选择的模型。但是它逐一给出。
HTML:
<div ng-dropdown-multiselect="" options="example13data" selected-model="example13model" extra-settings="example13settings" events="{ onItemSelect: dropdownChange,onItemDeselect:dropdownChange,onSelectAll:dropdownChange,onUnselectAll:dropdownChange }" translation-texts="example5customTexts"></div>
<div ng-dropdown-multiselect="" options="example14data" selected-model="example14model" extra-settings="example14settings" events="{ onItemSelect: dropdownChange,onItemDeselect:dropdownChange,onSelectAll:dropdownChange,onUnselectAll:dropdownChange }" translation-texts="example6customTexts"></div>
{{example13model}}
</div>
JS:
var myApp = angular.module('exampleApp', ['angularjs-dropdown-multiselect']);
myApp.controller('appController', ['$scope',
function($scope) {
$scope.example13model = [];
$scope.example13data = [{
"regionName": "ALAC",
"regionId": 178
}, {
"regionName": "ANZ",
"regionId": 177
}];
$scope.example5customTexts = {buttonDefaultText: 'Geo'};
$scope.example13settings = {
smartButtonMaxItems: 3,
displayProp: 'regionName',
idProp: 'regionId'
};
$scope.example14model = [];
$scope.example14data = [{
"countryName": "India",
"regionId": 178
}, {
"countryName": "ANZ",
"regionId": 177
}];
$scope.example6customTexts = {buttonDefaultText: 'Country'};
$scope.example14settings = {
smartButtonMaxItems: 3,
displayProp: 'countryName',
idProp: 'regionId'
};
$scope.dropdownChange = function(item){
console.log($scope.example13model);
$scope.example14data = [{
"countryName": "USA",
"regionId": 178
}];
};
}
]);
截图: Plunker.
如何立即获得多选模型。