angular-ui / ui-select2

AngularJS wrapper for select2 (deprecated, use angular-ui/ui-select)
https://github.com/angular-ui/ui-select
MIT License
596 stars 443 forks source link

Simple binding with Select2 data object option #276

Open RedJandal opened 10 years ago

RedJandal commented 10 years ago

I have changed the directive to always bind ng-model to the simple value returned by select2. I have also added a ui-data attribute that enables you to bind a property in your controller to the select2 data object if you need to access it.

Lets say select2 returns the object

{ id: 1, text: "My Selection" }

ng-model will equal 1 ui-data will equal

{ id: 1, text: "My Selection" }

This addresses the following issue

https://github.com/angular-ui/ui-select2/issues/126

Splaktar commented 10 years ago

Unfortunately this change appears to break many of the tests.