使用 angular-multi-select 我想在加载时显示 selected 选项
Using angular-multi-select I want to show selected options upon load
我正在使用 angular-multi-select (https://github.com/isteven/angular-multi-select) 并根据本地存储的输入加载 table。我成功地用输入加载了我的 table,但就我的 mutliselect 显示哪些选项被 selected 没有反映出来。我的 multiselect 下拉列表在加载时显示 "None Selected" 因为它似乎在加载时清除了 selected 或 'ticked' 项目,尽管我的 table 反映了selected 我想展示的项目。如何在加载时在下拉列表中显示预先 select 的项目?这是我正在使用的代码...
<div ng-hide="loadingCompanies"
isteven-multi-select
input-model="companies"
output-model="multiSelect.payorCompanies"
button-label="name"
item-label="name"
tick-property="ticked"
output-properties="id ticked"
max-labels="1"
>
</div>
在我的控制器中我有...
$scope.multiSelect = {};
$scope.multiSelect.payorCompanies = ReportService.getStoredReportFilter().payorCompanies;
$scope.multiSelect.payorCompanies 是 payorCompanies 数组,'ticked' 属性等于 true。
我明白了。实际上,我只需要将 $scope.companies 中的每个项目设置为具有等于 true 的 'ticked' 属性 :)
我正在使用 angular-multi-select (https://github.com/isteven/angular-multi-select) 并根据本地存储的输入加载 table。我成功地用输入加载了我的 table,但就我的 mutliselect 显示哪些选项被 selected 没有反映出来。我的 multiselect 下拉列表在加载时显示 "None Selected" 因为它似乎在加载时清除了 selected 或 'ticked' 项目,尽管我的 table 反映了selected 我想展示的项目。如何在加载时在下拉列表中显示预先 select 的项目?这是我正在使用的代码...
<div ng-hide="loadingCompanies"
isteven-multi-select
input-model="companies"
output-model="multiSelect.payorCompanies"
button-label="name"
item-label="name"
tick-property="ticked"
output-properties="id ticked"
max-labels="1"
>
</div>
在我的控制器中我有...
$scope.multiSelect = {};
$scope.multiSelect.payorCompanies = ReportService.getStoredReportFilter().payorCompanies;
$scope.multiSelect.payorCompanies 是 payorCompanies 数组,'ticked' 属性等于 true。
我明白了。实际上,我只需要将 $scope.companies 中的每个项目设置为具有等于 true 的 'ticked' 属性 :)