From ed2b243aaf2278cdb371d460d2c3c8d1430043f8 Mon Sep 17 00:00:00 2001 From: "Zhenyun.Wu" Date: Fri, 9 Nov 2018 17:01:57 +0800 Subject: [PATCH] fix(module: input-item): fix set value by ngzone.run (#101) --- .../input-item/custom-input/custom-input.component.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/components/input-item/custom-input/custom-input.component.ts b/components/input-item/custom-input/custom-input.component.ts index e981e929..dddbc0f6 100644 --- a/components/input-item/custom-input/custom-input.component.ts +++ b/components/input-item/custom-input/custom-input.component.ts @@ -7,7 +7,8 @@ import { OnInit, OnDestroy, ViewEncapsulation, - HostBinding + HostBinding, + NgZone } from '@angular/core'; import { CustomInputService } from './custom-input.service'; @@ -95,7 +96,7 @@ export class CustomInput implements OnInit, OnDestroy { @HostBinding('class.fake-input-container-left') clsFakeContainerLeft: boolean; - constructor(private _ref: ElementRef, private _customInputService: CustomInputService) {} + constructor(private _ref: ElementRef, private _customInputService: CustomInputService, private _ngZone: NgZone) {} onFakeInputClick() { if (this._preventKeyboard) { @@ -228,7 +229,9 @@ export class CustomInput implements OnInit, OnDestroy { this.onChange.emit(valueAfterChange); } } - this._value = valueAfterChange; + this._ngZone.run(() => { + this._value = valueAfterChange; + }); }; ngOnInit() {