Skip to content Skip to sidebar Skip to footer

Can't Select Item In List Created By Ui-select2

In my HTML I have this line: and the privsSelect2options function:

Solution 1:

the problem was that Priv class/table didn't have id property, and its Primary Key was field code. I had to add function :

id : function(priv) {
        return priv.code;
     },

in $scope.privNameSelect2options

Solution 2:

Please refer to Select2 Ajax Method Not Selecting,

and take the correct value:

id: function(data){return {id: data.id};},

or

id: function(data){returndata.id}

Solution 3:

Although this isn't really specified in the select2 documentation, you'll need to pass an id key with a function value to select2.

$scope.privsSelect2options = {
    id: function(element) { return element.name; }
    ...
}; 

Post a Comment for "Can't Select Item In List Created By Ui-select2"