This repository was archived by the owner on Oct 2, 2019. It is now read-only.
This repository was archived by the owner on Oct 2, 2019. It is now read-only.
Issues when using values ''
and false
#1328
Closed
Description
I have a bunch of items as so:
scope.items = [{
label: '-- None Selected --',
value: ''
}, {
label: 'Yes',
value: true
}, {
label: 'No',
value: false
}];
scope.model = '';
My HTML:
<ui-select ng-model="model">
<ui-select-match>{{ $select.selected.label }}</ui-select-match>
<ui-select-choices repeat="item.value as item in items track by item.value">{{ item.label }}</ui-select-choices>
</ui-select>
I'm expecting when the select box loads up to see the --None Selected--
item, since my model is set to the empty string, ''
. However, due to this line using a double equals instead of a triple equals, the No
item is actually displayed, since the formatter traverses from the end of the items array to the beginning, and when it finds the item with the false
value, it compares false == ''
which returns true
.
Is there any historical reason why this is a double equals instead of a triple equals? Would you accept a PR which changes this to triple equals?