Arun P Johny
Arun P Johny

Reputation: 388436

ui-select2(multiple) with jquery 1.7.x not selecting values

In my application I'm using jQuery 1.7(don't ask why :( ) with angularjs 1.2.5 and select2. I'm using ui-select2 for select2 integration with angularjs.

After updating to the latest version of ui-select2 the plugin stopped selecting values... The problem seems to the the priority: 1 option added by the directive to add support for angularjs 1.2.x this commit.

Demo: Plunker

Has anybody faced this problem?

Script

var app = angular.module('my-app', ['ui.select2'], function () {

})

app.controller('AppController', function ($scope) {
  $scope.transition = {};

    var results = [{
        id: '1',
        text: 'One',
        type: 1
    }, {
        id: '2',
        text: 'Two',
        type: 1
    }, {
        id: '3',
        text: 'Three',
        type: 1
    }, {
        id: '4',
        text: 'Fout',
        type: 1
    }]
  $scope.select2Options = {
        id: 'id',
            data: results,
            multiple: true
  }
})

HTML:

  <body ng-controller="AppController">
    <input class="trans-values" ui-select2="select2Options" ng-model="transition.value" style="width: 150px" multiple />
  </body>

Upvotes: 4

Views: 1636

Answers (2)

user1853287
user1853287

Reputation: 1

The documentation is not up to date. See here.

<div ui-select2="select2Options" ng-model="list_of_string"></div>

Upvotes: 0

Arun P Johny
Arun P Johny

Reputation: 388436

Was little too silly from me to not look at the issues list in github. Issues here and here

I solved it by changing the target element from input to div

Upvotes: 4

Related Questions