Html 如何使md芯片md分隔键与md自动完成一起工作?

Html 如何使md芯片md分隔键与md自动完成一起工作?,html,angular-material,Html,Angular Material,当我使用带有md分隔键的md芯片时,它可以工作。 如果我添加md自动完成,则md分隔键不起作用 这就是我如何使用它: <md-chips ng-model="chips.selectedChips" md-add-on-blur="true" md-separator-keys="customKeys" md-transform-chip="chips.transformChip($chip)" md-require-match="chips.all

当我使用带有md分隔键的md芯片时,它可以工作。 如果我添加md自动完成,则md分隔键不起作用

这就是我如何使用它:

<md-chips ng-model="chips.selectedChips" md-add-on-blur="true" md-separator-keys="customKeys"
          md-transform-chip="chips.transformChip($chip)"
          md-require-match="chips.allowToAddNew" md-autocomplete-snap>
  <md-autocomplete
      md-selected-item="chips.selectedItem"  
      md-search-text="chips.searchText"
      md-items="item in chips.querySearch(chips.searchText)"
      md-item-text="chips.getText(item)"
      placeholder="{{ field.hint }}">
    <span md-highlight-text="chips.searchText">{{ chips.getText(item) }}</span>
  </md-autocomplete>
  <md-chip-template>
    <span>{{ chips.getText($chip) }}</span>
  </md-chip-template>
</md-chips>
问题是:如何让它工作

p、 由于某些原因,附加模糊不工作,也会很高兴找到如何修复它


p、 另外,我发现github已经关闭,所以他们不会解决这个有效的问题。迷人

好的。我知道这不是一个完美的解决方案,而是一个解决办法。 这是我添加到自定义指令的链接方法中的内容:

scope.$watch('chips.searchText', function(newValue, oldValue) {
    if (!newValue || newValue.length < 2) {
        return;
    }
    if (";,".indexOf(newValue.substring(newValue.length - 1)) < 0) {
        return;
    }

    var chipName = newValue.substring(0, newValue.length - 1);
    if (!scope.chips.selectedChips) {
        scope.chips.selectedChips = [];
    }
    scope.chips.selectedChips.push(scope.chips.transformChip(chipName));
    scope.chips.searchText = '';
});
scope.$watch('chips.searchText',函数(newValue,oldValue){
如果(!newValue | | newValue.length<2){
返回;
}
if(“;,”.indexOf(newValue.substring(newValue.length-1))<0{
返回;
}
var chipName=newValue.substring(0,newValue.length-1);
如果(!scope.chips.selectedChips){
scope.chips.selectedChips=[];
}
scope.chips.selectedChips.push(scope.chips.transformChip(chipName));
scope.chips.searchText='';
});
我从
md芯片
中删除了
md分隔键
,因为它变得完全冗余

scope.$watch('chips.searchText', function(newValue, oldValue) {
    if (!newValue || newValue.length < 2) {
        return;
    }
    if (";,".indexOf(newValue.substring(newValue.length - 1)) < 0) {
        return;
    }

    var chipName = newValue.substring(0, newValue.length - 1);
    if (!scope.chips.selectedChips) {
        scope.chips.selectedChips = [];
    }
    scope.chips.selectedChips.push(scope.chips.transformChip(chipName));
    scope.chips.searchText = '';
});