2017-01-31 20 views
0

私は新しく角度があり、私はmd-not-foundを持つ自動完成品を持っています。私は私のモードが3である場合に非表示にする必要があります。見つからないようにする方法はありますか?以下は私のコードです。ng-hideはオートコンプリートmd-not-foundで動作しません

<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> 

答えて

1

は、今では私のコードをチェックし、働いている、それは3秒後に表示されなくなります。

angular.module("app", []).controller("MyController", function($scope) { 
 
    $scope.vm = {}; 
 
    $scope.vm.masterMode = 0; 
 
    setTimeout(function(){ 
 
     $scope.$apply(function(){ 
 
      $scope.vm.masterMode = 3; 
 
     }); 
 
    }, 3000); 
 
});
<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>

+0

しかし、私の場合、それが動作していない角度でいくつかのバグかもしれ1.4 :( –

+0

あなたはあなたのコードを深く掘り下げて鉱山と比較すると、あなたのものがあなたのバグを引き起こすことに気付くでしょう。違いを示すことができるなら、私はya – webmaster

関連する問題