Skip to content
This repository has been archived by the owner on May 5, 2018. It is now read-only.

Initial Values for select2 from ng-model are not set properly #455

Closed
SethBoyd opened this issue Feb 21, 2013 · 2 comments
Closed

Initial Values for select2 from ng-model are not set properly #455

SethBoyd opened this issue Feb 21, 2013 · 2 comments

Comments

@SethBoyd
Copy link

When a select2 directive is bound to a model that contains data, i.e. $scope.countries = [{id: 'US', text: 'United States'}], the initial value of the select2 will be set to [Object object]

To work around this I am manually grabbing the model value in an initSelection function passed in with the other select2 options.

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

Here is a demo displaying the issue:
http://plnkr.co/edit/DgpGyegQxVm7zH1dZIJZ?p=preview

And here is my original SO question.
http://stackoverflow.com/questions/14985346/setting-initial-values-of-angular-ui-select2-multiple-directive

@ProLoser
Copy link
Member

ProLoser commented May 3, 2013

AngularUI is currently undergoing a restructure. This project will no longer hold the codebase, can you please relocate this to https://github.com/angular-ui/ui-select2 (after confirming it's still necessary with the latest code)?

@nateabele
Copy link

This repo is discontinued. The project has been relocated here: https://github.com/angular-ui/ui-select2

Please reopen this issue there if it is still relevant.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants