ng2-datetime
ng2-datetime copied to clipboard
Changing the readonly attribute after initial load/render (i.e.: via binding) doesn't work
Thank you for the excellent plug-in :-)
I'm trying to toggle read-only mode using a binding expression like this:
<datetime [(ngModel)]="myDateTime" name="myDateTime" [readonly]="isMyDateTimeReadOnly" [timepicker]="false"></datetime>
On initial load the readonly attribute is set appropriately and the input behaves as expected. When the value of the property I'm binding to changes, the readonly attribute value changes as expected, but the behavior of the input doesn't change. For example, if "isMyDateTimeReadOnly" changes to true, the input will still display the datepicker when selected.
Would it be possible to make the readonly option bindable?
Setting it 'false' will not work, you have to make it 'null' for 'false'
[readonly]="isMyDateTimeReadOnly?true:null"
Will be fixed with #100
vsanat's workaround worked for me, thank you. I've been struggling with this