Skip to content

Commit

Permalink
fix(module:select): fix select compareWith array not work (#4140)
Browse files Browse the repository at this point in the history
close #4139
  • Loading branch information
vthinkxie authored Sep 17, 2019
1 parent de1e496 commit 2b4776d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion components/select/nz-select.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export class NzSelectComponent implements ControlValueAccessor, OnInit, AfterVie
this.value = value;
let listValue: any[] = []; // tslint:disable-line:no-any
if (isNotNil(value)) {
if (Array.isArray(value)) {
if (this.nzSelectService.isMultipleOrTags) {
listValue = value;
} else {
listValue = [value];
Expand Down
7 changes: 4 additions & 3 deletions components/select/nz-select.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@ export class NzSelectService {
// selected value or ViewChildren change
valueOrOption$ = combineLatest([this.listOfSelectedValue$, this.mapOfTemplateOption$]).pipe(
tap(data => {
this.listOfSelectedValue = data[0];
this.listOfNzOptionComponent = data[1].listOfNzOptionComponent;
this.listOfNzOptionGroupComponent = data[1].listOfNzOptionGroupComponent;
const [listOfSelectedValue, mapOfTemplateOption] = data;
this.listOfSelectedValue = listOfSelectedValue;
this.listOfNzOptionComponent = mapOfTemplateOption.listOfNzOptionComponent;
this.listOfNzOptionGroupComponent = mapOfTemplateOption.listOfNzOptionGroupComponent;
this.listOfTemplateOption = this.listOfNzOptionComponent.concat(
this.listOfNzOptionGroupComponent.reduce(
(pre, cur) => [...pre, ...cur.listOfNzOptionComponent.toArray()],
Expand Down

0 comments on commit 2b4776d

Please sign in to comment.