ngTagsInput
ngTagsInput copied to clipboard
Autocomplete list items not showing selected (Angular 1.3 only)
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+
I have the same issue. Unfortunately I can't upgrade right now. Anyone found a solution to this?
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;
};