Skip to content

Commit

Permalink
fix(datepicker): fix disabled state setter (#2798)
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyaSurmay authored and valorkin committed Oct 10, 2017
1 parent 934da3a commit bd04f61
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/datepicker/bs-datepicker-input.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 5 additions & 1 deletion src/datepicker/bs-daterangepicker-input.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit bd04f61

Please sign in to comment.