From bd04f61f3d2c51ac092cb451dc79e4fbf155d193 Mon Sep 17 00:00:00 2001 From: Ilya Surmay Date: Tue, 10 Oct 2017 03:39:52 +0300 Subject: [PATCH] fix(datepicker): fix disabled state setter (#2798) --- src/datepicker/bs-datepicker-input.directive.ts | 6 +++++- src/datepicker/bs-daterangepicker-input.directive.ts | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/datepicker/bs-datepicker-input.directive.ts b/src/datepicker/bs-datepicker-input.directive.ts index b7e27f70e9..bc1b12c907 100644 --- a/src/datepicker/bs-datepicker-input.directive.ts +++ b/src/datepicker/bs-datepicker-input.directive.ts @@ -71,7 +71,11 @@ export class BsDatepickerInputDirective setDisabledState(isDisabled: boolean): void { this._picker.isDisabled = isDisabled; - this._renderer.setAttribute(this._elRef.nativeElement, 'disabled', 'disabled'); + if (isDisabled) { + this._renderer.setAttribute(this._elRef.nativeElement, 'disabled', 'disabled'); + return; + } + this._renderer.removeAttribute(this._elRef.nativeElement, 'disabled'); } registerOnChange(fn: (value: any) => any): void { diff --git a/src/datepicker/bs-daterangepicker-input.directive.ts b/src/datepicker/bs-daterangepicker-input.directive.ts index 7c2fc0f8f0..d832719d97 100644 --- a/src/datepicker/bs-daterangepicker-input.directive.ts +++ b/src/datepicker/bs-daterangepicker-input.directive.ts @@ -82,7 +82,11 @@ export class BsDaterangepickerInputDirective setDisabledState(isDisabled: boolean): void { this._picker.isDisabled = isDisabled; - this._renderer.setAttribute(this._elRef.nativeElement, 'disabled', 'disabled'); + if (isDisabled) { + this._renderer.setAttribute(this._elRef.nativeElement, 'disabled', 'disabled'); + return; + } + this._renderer.removeAttribute(this._elRef.nativeElement, 'disabled'); } registerOnChange(fn: (value: any) => any): void {