valor-software / ng2-select

Angular based replacement for select boxes
http://valor-software.github.io/ng2-select/
MIT License
675 stars 587 forks source link

[allowClear] property binding #866

Open rpdyer opened 7 years ago

rpdyer commented 7 years ago

With the code below, from https://valor-software.com/ng2-select, property binding with square brackets is used to bind the "items" and "disabled" properties to member fields of the same name. So shouldn't allowClear be used below without square brackets since it is obviously binding to the value "true" rather than to a member field named "true". In my code I tried to use square brackets to bind the allowClear property to a boolean member field in my component, and it fails to work correctly. Does allowClear always have to be bound with square brackets, and always to the "true" and "false" literals?

<ng-select [allowClear]="true" [items]="items" [disabled]="disabled" (data)="refreshValue($event)" (selected)="selected($event)" (removed)="removed($event)" (typed)="typed($event)" placeholder="No city selected">

MIAOMIAOUP commented 7 years ago

allowClear (?boolean=false) (not yet supported) - Set to true to allow the selection to be cleared. This option only applies to single-value inputs.