2017-10-04 60 views
0

我正在使用角度形式的標籤輸入組件。ngx-chips最小文本長度

https://github.com/Gbuomprisco/ngx-chips

的數據來自http服務(觀察不到)。

在使用ngx-chips執行休息調用之前,我無法在文檔中找到指定最小文本長度的方法。

我的HTML片段

<tag-input name="tagList" [addOnBlur]="true" formControlName="tagList" theme='bootstrap' [clearOnBlur]="true" [onlyFromAutocomplete]="false" onTextChangeDebounce="100"> 
    <tag-input-dropdown [autocompleteObservable]="requestTags" > 
</tag-input-dropdown> 

我requestTags功能是:

public requestTags = (text:string) =>{ 
    return this.resourceService.findMatchingTags(text); 
}; 

感謝

回答

0

看源代碼似乎標籤輸入下拉菜單有一個輸入屬性 minimumTextLength即最小文本以顯示自動完成下拉列表並且不執行Observable調用。可以使用如下:

<tag-input name="tagList" [addOnBlur]="true" formControlName="tagList" theme='bootstrap' [clearOnBlur]="true" [onlyFromAutocomplete]="false" onTextChangeDebounce="100"> 
    <tag-input-dropdown [autocompleteObservable]="requestTags" [minimumTextLength]="2"> 
</tag-input-dropdown>