Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs单选ng下拉列表多选_Angularjs - Fatal编程技术网

Angularjs单选ng下拉列表多选

Angularjs单选ng下拉列表多选,angularjs,Angularjs,我是angularjs的新手,正在努力解决这个问题。 我的问题是如何从ng下拉列表multiselect中进行单选。我发现了一些解决方案,如: vm.dropDownAreaSelection = { selectionLimit: '1', closeOnSelect: true, displayProp: 'name', idProp : 'name', showCheckAll : false, showUncheck

我是angularjs的新手,正在努力解决这个问题。 我的问题是如何从ng下拉列表multiselect中进行单选。我发现了一些解决方案,如:

vm.dropDownAreaSelection = {
      selectionLimit: '1',
      closeOnSelect: true,
      displayProp: 'name',
      idProp : 'name',
      showCheckAll : false,
      showUncheckAll : false,
      onChange: vm.filterChangedSelection,
      smartButtonMaxItems: 1,
    };

<div ng-dropdown-multiselect
     options="vm.selectArea"
     selected-model="vm.selected.areaObj"
     extra-settings="vm.dropDownAreaSelection"></div>
vm.dropDownAreaSelection={
selectionLimit:'1',
closeOnSelect:正确,
displayProp:'名称',
idProp:'名称',
showCheckAll:false,
肖恩切卡尔:错,
onChange:vm.filterChangedSelection,
smartButtonMaxItems:1,
};
它的工作很好,但当我选择一个项目之前选择的是没有取消选择。我使用的是angularjs 1.5.3

任何帮助都将不胜感激


提前感谢

确保所选型号不是阵列。它应该是对象

vm.selected.areaObj = {};
对于超过1个选择限制,它应该是数组

vm.selected.areaObj = [];

ng下拉列表multiselect在选择时触发许多事件。可能你可以手动清除模型。如果你只想选择一个项目,为什么你需要ng dropdown multiselect?实际上它已经为ng dropdown multiselect制作了一个大过滤器,我试图使选择/选项代码崩溃。所以我需要修复现有的结构。