Reputation: 1001
We are using ngx-chips for autocomplete text box, where we are fetching data from the remote source. If we copy paste an item and press Tab button we need to select the single item. But this is not working.
Any help will be highly appreciated.
Our code is as below
<tag-input formControlName="Tag"
placeholder = "select"
secondaryPlaceholder = "select"
[validators]="Validator"
[onlyFromAutocomplete]="true"
[onTextChangeDebounce] = "1000"
(keyup)="onSearchType($event.target.value)"
class="tag-input-class tag-inp"
>
<tag-input-dropdown
[autocompleteItems]="List"
[dynamicUpdate]="true"
[appendToBody]="true"
[showDropdownIfEmpty]="false"
[keepOpen]="false"
[zIndex] = "1000000"
[displayBy]="'property'"
[identifyBy] ="'property'"
>
</tag-input-dropdown>
</tag-input>
Upvotes: 1
Views: 1604
Reputation: 2643
You can use separatorKeyCodes
attribute to achieve this,
<tag-input formControlName="Tag"
placeholder = "select"
secondaryPlaceholder = "select"
[validators]="Validator"
[onlyFromAutocomplete]="true"
[onTextChangeDebounce] = "1000"
[separatorKeyCodes]="'TAB'" or "TAB" or "[TAB]" //please try this
(keyup)="onSearchType($event.target.value)"
class="tag-input-class tag-inp">
<tag-input-dropdown
[autocompleteItems]="List"
[dynamicUpdate]="true"
[appendToBody]="true"
[showDropdownIfEmpty]="false"
[keepOpen]="false"
[zIndex] = "1000000"
[displayBy]="'property'"
[identifyBy] ="'property'">
</tag-input-dropdown>
</tag-input>
Upvotes: 1