biesczadka biesczadka - 1 year ago 100
HTML Question

Can't select item in list created by ui-select2

In my HTML I have this line:

<input ng-change="privChanged()" ng-model="selectedPriv" ui-select2="privsSelect2options"></input>

and the

$scope.privsSelect2options = {
placeholder: "Wybierz privo",
minimumInputLength: function(){return 3;},
formatInputTooShort: function (input, min) {return "Wprowadź conajmniej " + min + " znaki.";},
formatSearching: function () { return "Wyszukiwanie..."; },
formatNoMatches: function () { return "Nie znaleziono pasujących województw."; },
query: function (query) {
query.callback( {results: $filter('filter')($scope.privs,{name: query.term}) } );
formatResult: function(priv){
formatSelection: function(priv){

Everything works OK when I put 3 letters it filters the result and shows it correct but I can't click and select any item from the result list. Can anyone help me in this matter? It doesn't even come into the

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download