Skip to content

Commit

Permalink
fix(bootstrap): add missing compareWith input to the select type (#1978)
Browse files Browse the repository at this point in the history
fix #1974
  • Loading branch information
aitboudad committed Dec 13, 2019
1 parent 510570e commit 14f9964
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/bootstrap/src/lib/types/select.ts
Expand Up @@ -8,6 +8,7 @@ import { FieldType } from '@ngx-formly/core';
multiple
[class.custom-select]="to.customSelect"
[formControl]="formControl"
[compareWith]="to.compareWith || compareWith"
[class.is-invalid]="showError"
[formlyAttributes]="field">
<ng-container *ngFor="let item of to.options | formlySelectOptions:field | async">
Expand All @@ -24,6 +25,7 @@ import { FieldType } from '@ngx-formly/core';
<select class="form-control"
#select
[formControl]="formControl"
[compareWith]="to.compareWith || compareWith"
[class.custom-select]="to.customSelect"
[class.is-invalid]="showError"
[formlyAttributes]="field">
Expand Down Expand Up @@ -57,4 +59,8 @@ export class FormlyFieldSelect extends FieldType implements AfterViewChecked {
}
}
}

compareWith(o1: any, o2: any) {
return o1 === o2;
}
}

0 comments on commit 14f9964

Please sign in to comment.