首页 > 解决方案 > 在不打开下拉菜单的情况下触发 ng-select on-blur 事件

问题描述

ng-select在我的项目中使用过,但是只有当我从下拉列表中选择选项时才会触发 onblur 事件,这就是我所拥有的,

<ng-select [addTag]="true" [editableSearchTerm]="true" [items]="multiples['document_id']" bindValue="name" bindLabel="name"
                    [multiple]="false" [maxSelectedItems]="1" [clearSearchOnAdd]="true" placeholder="Select or type"
                    [searchable]="true" [(ngModel)]="outputQipJson.document_id"
                    *ngIf="editable && editablefeildname =='document_id'" (blur)="focusOutFunction('document_id');"
                    (change)="onSelectQip('document_id', $event)" style="font-size: 11px;" name="document_id"
                    #document_id>
                  </ng-select>

如果我想在不打开下拉菜单的情况下从 ng-select 聚焦时触发 onblur,我该怎么办?

版本:

"@ng-select/ng-select": "^3.7.3",
"@angular/core": "~10.1.0",

标签: angularangular-ngselect

解决方案


推荐阅读