Setting initial values of Angular-UI Select2 multiple directive Setting initial values of Angular-UI Select2 multiple directive angularjs angularjs

Setting initial values of Angular-UI Select2 multiple directive


As requested by ProLoser here is a demo and github ticket.

Demo: http://plnkr.co/edit/DgpGyegQxVm7zH1dZIJZ?p=preview

GitHub Issue: https://github.com/angular-ui/angular-ui/issues/455

Following ProLoser's advice I started using select2's initSelection function:

initSelection : function (element, callback) {  callback($(element).data('$ngModelController').$modelValue);},

It does the trick but still feels like a workaround.


Have you tried initialising your options as:

<option selected value="0">Name</option>