在ngx-chips中的Tab和Spacebar事件上动态添加标签

请告诉我如何在ngx芯片中的Tab和Spacebar事件中动态添加标签。

在ngx-chips中的Tab和Spacebar事件上动态添加标签

iCMS 回答:在ngx-chips中的Tab和Spacebar事件上动态添加标签

使用 separatorKeyCodes (数字[])或 separatorKeys (字符串[])

 <div class="force-to-the-bottom">
  <tag-input [ngModel]="['hardocoded-item']" [separatorKeyCodes]="[32,9]">
  <tag-input-dropdown
    [autocompleteItems]="items"
    [showDropdownIfEmpty]="true"
    [dynamicUpdate]="false">
 </tag-input-dropdown>

https://stackblitz.com/edit/ngx-chips-example-miqu3i?file=app%2Fshared%2Ftag-input%2Ftag-input.component.html

本文链接:https://www.f2er.com/1931318.html

大家都在问