kekeh / angular-mydatepicker

Angular datepicker and date range picker :date:
https://kekeh.github.io/angular-mydatepicker/
MIT License
1 stars 11 forks source link

Bug when initializing a disabled datepicker #68

Closed skaireka closed 3 years ago

skaireka commented 3 years ago

If a datepicker is initialized with a value when it's not disabled - everything works fine. If a datepicker is initialized with a value and set as disabled - date doesn't show in the input and instead placeholder is shown.

Stackblitz example: https://stackblitz.com/edit/angular-9-1-0-angular-mydatepicker-ygezxo The only difference between the inputs is one is [disabled]="isDisabled" the other [disabled]="!isDisabled"

I haven't actually found a disabled property in the docs, so I'm wondering if I missed something or if this is a bug?

kekeh commented 3 years ago

Hello @skaireka

Here is working version: https://stackblitz.com/edit/angular-9-1-0-angular-mydatepicker-vmoc3v?file=src%2Fapp%2Fchild%2Fchild.component.html

You can define the disable attribute this way: [attr.disabled]="isDisabled" then it is working.

kekeh commented 3 years ago

You can do disable/enable: <input name="mydate" angular-mydatepicker [attr.disabled]="isDisabled ? '' : null" />

skaireka commented 3 years ago

That works, thank you!