AngularJS/Bind to Multiple Select Element
by manoj
HTML
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css">
<div ng-app ng-controller="Controller" class="container">
<select ng-options="record.id as record.value for record in records" ng-model="output" multiple="multiple"></select>
<button ng-click="alertValues()">Click Me!</button>
</div>
JavaScript
function Controller($scope) {
$scope.output = "";
$scope.records = [{
id: 1,
value: "One",
}, {
id: 2,
value: "Two",
}, {
id: 3,
value: "Three",
}];
$scope.alertValues = function(){
alert($scope.output);
}
}