ngx-bootstrap icon indicating copy to clipboard operation
ngx-bootstrap copied to clipboard

Datepicker - [isDisabled] is not working when using formControlName

Open maxcl10 opened this issue 1 year ago • 3 comments

Bug description:

I'm using the datepicker control in a reactive form. The control is working fine. However, in some cases I want to disable the control. I added the following code.

[isDisabled]="isDisabled"

but the control is still enabled. I was able to figure out that the issue comes from the fromControlName property. If I remove the formControlName attribute, then the datepicker is correctly disabled.

Versions of ngx-bootstrap, Angular, and Bootstrap:

ngx-bootstrap: 10.2.0 and 10.3.0

Angular: 15

Bootstrap: 5

Expected behavior

The datepicker must be disabled.

maxcl10 avatar May 02 '23 13:05 maxcl10

@maxcl10 Similar issue, we have upgraded to Angular 15 and ngx-bootstrap to 10.x.x and Bootstrap to 5.x.x Is there any other way except removing fromControlName ?

vaibhav915 avatar Jul 24 '23 12:07 vaibhav915

The property [isDisabled]="isDisabled" disabled only dates of component.One solution for this situation is use attr.disabled on input

alewebcode avatar Aug 17 '23 13:08 alewebcode

This is an issue of Angular 15 https://github.com/angular/angular/issues/48350

tuanbjnh avatar Aug 23 '23 10:08 tuanbjnh

You got to provide disable attribute for form-controls in your component.ts now

lexasq avatar Jul 12 '24 09:07 lexasq