我已经对此进行了一段时间的破解,但似乎无法像我所想的那样使它工作。也许甚至没有可能,但无论如何我都会在这里问。
<ui-select ng-model="finalReceive" multiple title="Choose an item">
<ui-select-match placeholder="Select or search an Item in the list...">{{$item.company_name}}</ui-select-match>
<ui-select-choices repeat="item in cropplans2">
<div ng-bind-html="item.company_name | highlight: $select.search"></div>
<small ng-bind-html="item.user.email | highlight: $select.search"></small>
</ui-select-choices>
</ui-select>
所以我有这个,项目列表将会出现,我可以选择多个选项。我想知道的是,是否可以从ui-select之外添加这些选项。
我拥有的是:
<input type="checkbox" name="receive" ng-click='addToReceiveList(sku)' ><label>Receive</label>
理想情况下,当我单击“接收”时,我希望它附加到选定项列表中,而ui-select和复选框select都将共享相同的$ scope。我尝试研究$scope.receiveList.selected
,但这是一本字典,只允许我一次选择一个。
编辑:已解决问题:我刚刚将$scope.receiveList.selected
称为数组,并且能够将每个项目推送到该数组。