2017-02-27 35 views
2

經過大量時間調查以解決問題以允許任何標記以及ngInputTag中的自動補全功能。我最終沒有結果。 問題是,當我輸入自動完成列表中的文本時,標籤被成功添加,但是當點來添加不在標籤列表中的標籤時,它接受第一個標籤,但是當我輸入第二個標籤時,它不在自動完成列出它使文本顏色爲紅色並且不接受標記輸入。在ngInputTag中自動完成時自動補全自動補全=「false」控件失效

要解決此問題,我已使用標籤添加但它沒有奏效。同樣的問題已經被報告上的Git轂Issue Link

下面是我的代碼: HTML

<tags-input ng-model="model" display-property="Name" key-property="Key" 
      placeholder="Enter Tags" add-from-autocomplete-only="false" 
      allow-leftover-text="true"> 
      <auto-complete source="loadTags($query)" 
         highlight-matched-text="true" 
         select-first-match="true"> 
      </auto-complete> 
</tags-input> 

控制器JS代碼:

$scope.model = []; 
$scope.loadTags = function (query) { 
      var deferred = $q.defer(); 
      $http.get(ApiUrls.GetTagsByQuery + (query != null ? ("?query=" + query) : "")) 
       .then(function (result) { 
        if (result.data == null) { 
         result = []; 
        } 
        deferred.resolve(result.data); 
       }, 
       function (response) { 
        deferred.reject(response); 
       }); 
      return deferred.promise; 
     }; 

任何幫助將高度讚賞。謝謝。

回答

0

同樣的問題!!!但是,如果你刪除鍵屬性,那麼它會起作用。

關鍵屬性是隻重複的問題

+0

我的問題後,該庫的新版本發佈在這個問題僅通過寫文本而不鍵解決。 –