From 2bf24e0a763aaa885ce0c8fd5243ee0b50471a10 Mon Sep 17 00:00:00 2001 From: VTHINKXIE Date: Fri, 25 Aug 2017 21:37:37 +0800 Subject: [PATCH] fix(module:select): fix select reset bug in form (#153) close #128 --- src/components/select/nz-select.component.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/select/nz-select.component.ts b/src/components/select/nz-select.component.ts index efba53f2cb3..4c2fe453872 100644 --- a/src/components/select/nz-select.component.ts +++ b/src/components/select/nz-select.component.ts @@ -492,7 +492,11 @@ export class NzSelectComponent implements OnInit, AfterContentInit, AfterContent if (this._value === value) { return; } - this._value = value; + if ((value === null) && this.nzMultiple) { + this._value = []; + } else { + this._value = value; + } if (!this.nzMultiple) { if (value === null) { this._selectedOption = null; @@ -506,6 +510,8 @@ export class NzSelectComponent implements OnInit, AfterContentInit, AfterContent } else { this.updateSelectedOption(value, true); } + } else if (value === null) { + this.clearAllSelectedOption(); } }