angularjs - select multiple

http://angularjs.org/

by arzo

HTML

<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<script src="https://raw.github.com/ivaynberg/select2/master/select2.js"></script>
<link rel="stylesheet" href="https://raw.github.com/ivaynberg/select2/master/select2.css">
<div ng-controller="MyCtrl">
    <select size="10" id="myselection" multiple ng-multiple="true" ng-model="selectedColors" ng-options="c.name+' ('+c.shade+')' for c in colors"></select>

    <button ng-click="doCustom()">Select Customization</button>

    <div>
        Selected Colors: {{selectedColors }}
    </div>

</div>

JavaScript

var myApp = angular.module('myApp', []);

function MyCtrl($scope) {

    $scope.test = "Das ist ein Test";
    $scope.colors = [{name: 'black',shade: 'dark'},{name: 'white',shade: 'light'},{name: 'red',shade: 'dark'},{name: 'blue',        shade: 'dark'},{name: 'yellow', shade: 'light'}
    ];

    $scope.selectedColors = [$scope.colors[1],$scope.colors[3]];

    $scope.doCustom=function() {
        $('#myselection').select2();
    };
}