0

I am using multi option selected select box in my angularjs project. But i am not getting all the selected option from the select box. the html code i am using for this is

<select class="form-control crm-select-multiple" multiple="multiple" ng-options="option.name for option in cab.availableOptions track by option.id" ng-model="cab.selectedCab"></select>

the angular code to print selected value is

var cab = $scope.cab.selectedCab;
console.log(cab);

but it is not printing all selected values, printing only one value. so any idea how to print selected value from multi select box.

2 Answers 2

2

Your ng-model should be an array for multi-select. Declare it as

Controller:

$scope.selectedCab = [];

HTML:

<select class="form-control crm-select-multiple" multiple="multiple" ng-options="option.name for option in cab.availableOptions track by option.id" ng-model="selectedCab"></select>
Sign up to request clarification or add additional context in comments.

Comments

0

I think you can check this fiddle for selecting multiple values

http://jsfiddle.net/DianaNassar/6W8Xg/1/

   <select ng-options="record.id as record.value for record in records" ng-model="output" multiple="multiple"></select>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.