1

Angular js version 1.5.9
Angular material 1.1.3

Using md-chips with md-autocomplete, when selecting a chip with the keyboard, after deleting it, the md-autocomplete will still think the keyboard is selecting it.
An example is better than words :
multiple selected elements while no selected in reality

I have tried setting md-no-cache, but this does not change the result. This error can be visible on the angular material demo at : https://material.angularjs.org/latest/demo/chips on the custom inputs section

Here is the fiddle of my version that has the same problem :
https://jsfiddle.net/JJTheo/9z34r9rc/2/

<md-chips ng-model="ctrl.selectedVegetables" 
        md-transform-chip="ctrl.transformChip($chip)" 
        md-require-match="false">
<md-autocomplete 
  md-selected-item="ctrl.selectedItem" 
  md-search-text="ctrl.searchText" 
  md-items="item in ctrl.querySearch(ctrl.searchText)" 
  md-item-text="item.name" 
  md-no-cache="true"
  placeholder="Vegetable name">
  <span md-highlight-text="ctrl.searchText">
    {{item.name}} :: {{item.type}}
  </span>
</md-autocomplete>
<md-chip-template>
  <span>
    <strong>{{$chip.name}}</strong>
    <em>({{$chip.type}})</em>
  </span>
</md-chip-template>

4

0 回答 0