我在我的应用中使用AngularJS Dropdown Multiselect,在示例中说我可以在角度控制器的selectionLimit
内设置extra-settings
,但我想要的selectionLimit
具有的下拉菜单是动态的(这是一个ng-repeat
值,用户可以在input
框中随时更改)
下拉列表由ng-repeat
生成。
<tr ng-repeat="detail in mainCtrl.lineDetails">
<td>
<div ng-dropdown-multiselect="true" options="mainCtrl.Customers" selected-model="detail.SelectedCustomers" extra-settings="mainCtrl.selectedCustomersSettings">
</div>
</td>
<td>
<input type="number" id="SelectionLimit" name="SelectionLimit" ng-model="detail.SelectionLimit" ng-min="0" required/>
</td>
</tr>
设置
self.selectedCustomersSettings = {
searchField: 'name',
enableSearch: true,
displayProp: 'name',
scrollableHeight: '300px',
scrollable: true,
keyboardControls: true,
idProperty: 'name',
buttonClasses: 'form-control drpdwn-btn'
};
答案 0 :(得分:0)
以下解决方案对我有用。我添加了设置inline
,以便可以将selectionLimit
的值设置为ng-repeat
。
<div ng-dropdown-multiselect="true" options="mainCtrl.Customers" selected-model="detail.SelectedCustomers" extra-settings="{searchField: 'name',enableSearch: true,displayProp: 'name',scrollableHeight: '300px',scrollable: true,keyboardControls: true,idProperty: 'name',buttonClasses: 'form-control drpdwn-btn',selectionLimit:detail.NoOfStores}" >
</div>