你可以md-selected-item-change
用来处理这个。例如
<md-autocomplete flex
md-item-text="item.Text"
md-items="item in data"
md-search-text-change="query(searchText)"
md-search-text="searchText"
md-selected-item="selectedItem"
md-no-cache="false"
md-input-minLength="2"
md-input-name="exampleAutocomplete"
md-selected-item-change="addSelectedItem();"
md-floating-label="Nereye">
<md-item-template>
<span md-highlight-text="searchText">{{item.Text}}</span>
</md-item-template>
<md-not-found>No matching were found were "{{searchText}}".</md-not-found>
</md-autocomplete>
在您的控制器端,您必须定义一个名为“addSelectedItem”的函数,并为 searchText 分配一个空字符串。喜欢;
$scope.addSelectedItem = function () {
$scope.searchText = '';
};
这个对我有用。希望它能帮助你解决你的问题。