ngTagsInput icon indicating copy to clipboard operation
ngTagsInput copied to clipboard

Autocomplete list items not showing selected (Angular 1.3 only)

Open numscrl opened this issue 8 years ago • 2 comments

Selected list item in the autocomplete list does not appear selected when running in an Angular 1.3.11 environment. Selected autocomplete list items appear normal in Angular 1.4+

numscrl avatar Sep 05 '17 16:09 numscrl

I have the same issue. Unfortunately I can't upgrade right now. Anyone found a solution to this?

behamon avatar Jan 26 '18 09:01 behamon

I ended up modifying the library code to resolve the problem, as follows:

scope.getSuggestionClass = function (item, index)
{
   var selected = item === suggestionList.selected;
   var classes = [scope.matchClass({ $match: item, $index: index, $selected: selected }), { selected: selected }];

   // REVISED TO MERGE OUTPUT ARRAY INTO SINGLE OBJECT AS ARRAY FORMAT DOES NOT SEEM
   // TO BE SUPPORTED FOR NG-CLASS DIRECTIVE IN ANGULAR 1.3

   var output = {};

   angular.forEach( classes, function( ngClass )
   {
       angular.forEach( ngClass, function( value, key )
       {
           output[key] = value;
       });
   });

   // END REVISION

   return output;
};

numscrl avatar Jan 26 '18 19:01 numscrl