0

I want to have an input with autocomplete suggestions in a chrome extension. I face a very weird issue.

Once I get the focus on my input, the suggestions menu is opened well with good values but then if I focus anywhere else, the suggestion menu never hide, I still can see an empty suggestion menu opened under my first input. It just never hides himself.

All the other functionalities are working well.

I tried this without effect : Angular Material: md-autocomplete - how to hide md-autocomplete-suggestions on Enter event?

Here's my html :

<md-chips ng-model="ctrl.newTags" 
          md-autocomplete-snap 
          md-transform-chip="ctrl.newVeg($chip)" 
          md-require-match="false">
    <md-autocomplete id="Auto" 
                     md-selected-item="ctrl.selectedItem" 
                     md-search-text="ctrl.searchText" 
                     md-items="item in ctrl.querySearch(ctrl.searchText)" 
                     md-item-text="item.name" 
                     placeholder="Enter a tag">
        <span md-highlight-text="ctrl.searchText">{{item.value}}</span>
    </md-autocomplete>
    <md-chip-template>
        <span>
            <strong>{{$chip.value}}</strong>
        </span>
    </md-chip-template>
</md-chips>

And my JS code :

self.newVeg = function(tag) {
    if (angular.isObject(tag)) {
        return tag.value;
    } else if (angular.isString(tag)) {
        return tag;
    }
};
self.querySearch = function(search) {
    search = search || "";
    return self.existingTags.filter(function(vO) {
        return !search || vO.value.toLowerCase().indexOf(search.toLowerCase()) >= 0 ;
    });
};

I'm asking myself if it doesn't work because of the fact it's in a chrome extension but it looks too simple...

The picture of my problem just to be clear : enter image description here

Thanks if anyone knows why or get the same mistake !

Matt.

Community
  • 1
  • 1
matt2mi
  • 156
  • 3
  • 14

2 Answers2

0

I had the same problem using angular-material in a chrome extension. Adding this to my css fixed it:

.ng-hide {
display: none;
}

Incidentally, I also had issues with the ng-show directive not working in my chrome extension, and adding this css class appeared to solve those issues as well.

John Shea
  • 1
  • 2
  • Sorry to let my question without response, i solved it with the new version of angular-material, now all issues left. – matt2mi Oct 13 '16 at 14:29
0

Problem solved with the new version of angular material.

matt2mi
  • 156
  • 3
  • 14