我是棱角分明的新手,我有一个自动完成的md-not-found。如果我的模式是3,我需要隐藏。无论模式中的值是什么,都找不到alwasy displys。有没有找不到隐藏的方法?以下是我的代码。
<md-autocomplete id="autoCompleteSearchBox"
class="search-box search-auto-complete" flex tabindex="0"
ng-disabled="!!vm.isDisabled"
md-no-cache="!!vm.noCache"
md-min-length="1"
md-delay="50"
md-selected-item="vm.selectedItem"
md-search-text="vm.text"
md-items="item in vm.query(vm.text)"
md-item-text="item.display"
md-selected-item-change="vm.selectItem()"
md-search-text-change="vm.reset()"
md-select-on-match="true"
md-input-id="txt_search"
placeholder="{{vm.hint()}}"
on-enter
md-autofocus>
<md-item-template ng-if="vm.masterMode !==3">
<div layout="row" layout-align="space-between center" style="max-height: 32px">
<span md-highlight-text="vm.search.text" md-highlight-flags="^i">{{item.display}}</span>
<span>({{item.count}})</span>
</div>
</md-item-template>
<md-not-found ng-hide="vm.masterMode===3">
Search for "{{vm.text}}".
</md-not-found>
</md-autocomplete>
答案 0 :(得分:1)
现在它正在工作,检查我的代码,它将在三秒后隐藏:
angular.module("app", []).controller("MyController", function($scope) {
$scope.vm = {};
$scope.vm.masterMode = 0;
setTimeout(function(){
$scope.$apply(function(){
$scope.vm.masterMode = 3;
});
}, 3000);
});
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="app" ng-controller="MyController"><md-autocomplete id="autoCompleteSearchBox"
class="search-box search-auto-complete" flex tabindex="0"
ng-disabled="!!vm.isDisabled"
md-no-cache="!!vm.noCache"
md-min-length="1"
md-delay="50"
md-selected-item="vm.selectedItem"
md-search-text="vm.text"
md-items="item in vm.query(vm.text)"
md-item-text="item.display"
md-selected-item-change="vm.selectItem()"
md-search-text-change="vm.reset()"
md-select-on-match="true"
md-input-id="txt_search"
placeholder="{{vm.hint()}}"
on-enter
md-autofocus>
<md-item-template ng-if="vm.masterMode !==3">
<div layout="row" layout-align="space-between center" style="max-height: 32px">
<span md-highlight-text="vm.search.text" md-highlight-flags="^i">{{item.display}}</span>
<span>({{item.count}})</span>
</div>
</md-item-template>
<md-not-found ng-hide="vm.masterMode == 3">
Search for "{{vm.text}}".
</md-not-found>
</md-autocomplete></div>
&#13;