Kandianne Pierre
Kandianne Pierre

Reputation: 334

Using angular-multi-select I want to show selected options upon load

I'm using angular-multi-select (https://github.com/isteven/angular-multi-select) and loading a table based on inputs that are locally stored. I am successfully loading my table with the inputs but as far as my mutliselect showing which options are selected that is not reflected. My multiselect dropdown shows "None Selected" upon load because it seems as though it clears out selected or 'ticked' items upon load, although my table is reflecting the selected items I want to show. How can I show preselected items in the dropdown on load? Here is the code I'm using...

              <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>

and in my controller I have...

$scope.multiSelect = {};
$scope.multiSelect.payorCompanies = ReportService.getStoredReportFilter().payorCompanies;

$scope.multiSelect.payorCompanies is an array of payorCompanies with the 'ticked' attribute equaling true.

Upvotes: 0

Views: 1346

Answers (1)

Kandianne Pierre
Kandianne Pierre

Reputation: 334

I got it. I actually just had to set each item in $scope.companies to have a 'ticked' attribute that equals true :)

Upvotes: 0

Related Questions