ng-select 中 [clearable] 的替代项是什么
What is the alternative of [clearable] in ng-select
我不想使用 ng-select
中的 [clearable]
来泄露我的 space。而不是 [clearable]
我只想使用 [clearOnBackspace]
但是当我写 [clearable] = "false"
和 [clearOnBackspace] = "true"
它不起作用。
enter code here
<ng-select [items]="cities"
bindLabel="name"
placeholder="Select city"
[(ngModel)]="selectedCity"
[clearable]="false"
[clearOnBackspace] = "true"
[excludeGroupsFromDefaultSelection] = "true">
</ng-select>
如果你这样做 [clearable]="false"
将不允许清除选择。
您可以使用css隐藏关闭图标。像这样
.ng-clear-wrapper{
display: none;
}
并保持 ng-select
不变
<ng-select [items]="cities"
bindLabel="name"
placeholder="Select city"
[(ngModel)]="selectedCity"
[clearable]="true"
[clearOnBackspace] = "true"
[excludeGroupsFromDefaultSelection] = "true">
事实上你不需要[clearOnBackspace] = "true"
我不想使用 ng-select
中的 [clearable]
来泄露我的 space。而不是 [clearable]
我只想使用 [clearOnBackspace]
但是当我写 [clearable] = "false"
和 [clearOnBackspace] = "true"
它不起作用。
enter code here
<ng-select [items]="cities"
bindLabel="name"
placeholder="Select city"
[(ngModel)]="selectedCity"
[clearable]="false"
[clearOnBackspace] = "true"
[excludeGroupsFromDefaultSelection] = "true">
</ng-select>
如果你这样做 [clearable]="false"
将不允许清除选择。
您可以使用css隐藏关闭图标。像这样
.ng-clear-wrapper{
display: none;
}
并保持 ng-select
不变
<ng-select [items]="cities"
bindLabel="name"
placeholder="Select city"
[(ngModel)]="selectedCity"
[clearable]="true"
[clearOnBackspace] = "true"
[excludeGroupsFromDefaultSelection] = "true">
事实上你不需要[clearOnBackspace] = "true"