Skip to content

Commit

Permalink
fix: use special value mapping for ng-options
Browse files Browse the repository at this point in the history
fixes: #469
  • Loading branch information
varnastadeus committed Apr 18, 2018
1 parent 0d1d13c commit 61d61a2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ng-select/items-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ export class ItemsList {
label = this.resolveNested(item, this._ngSelect.bindLabel);
label = isDefined(label) ? label.toString() : '';
}
const value = isDefined(item.value) ? item.value : item;
const value = isDefined(item.$ngOptionValue) ? item.$ngOptionValue : item;
return {
index: index,
label: label,
Expand Down
2 changes: 1 addition & 1 deletion src/ng-select/ng-select.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C
private _setItemsFromNgOptions() {
const handleNgOptions = (options: QueryList<NgOptionComponent>) => {
this.items = options.map(option => ({
value: option.value,
$ngOptionValue: option.value,
label: option.elementRef.nativeElement.innerHTML,
disabled: option.disabled
}));
Expand Down

0 comments on commit 61d61a2

Please sign in to comment.