0
I need a datepicker
disabled
, he owns a formControlName
because its value is changed according to the requests:
<kendo-datepicker disabled formControlName="AgendaData"></kendo-datepicker>
The problem is that this way I get a Warning on the console:
It looks like you’re using the disabled attribute with a reactive form Directive. If you set disabled to true when you set up this control in your Component class, the disabled attribute will Actually be set in the DOM for you. We recommend using this approach to avoid 'changed after checked' errors.
Example: form = new FormGroup({ first: new FormControl({value: 'Nancy', disabled: true}, Validators.required), last: new FormControl('Drew', Validators.required) });
I tried to do it in my form group as it shows, but it didn’t work.
I tried something like:
AgendaData: new FormControl({new: new Date(), disabled: true}, [Validators.required]),
But this way I have:
The 'value' should be a Valid Javascript Date
I also tried to:
Agendadata: new Formcontrol({new: new Date(Date.now()), disabled: true}, [Validators.required]),
tries to take html disable from its component
– Eduardo Vargas
I’ve taken and I’m trying to treat on ts, but I have the console errors as shown in the post!
– veroneseComS
You have tried <Kendo-datepicker formControlName="Agendadata"></Kendo-datepicker>? even though you give Warning?
– Eduardo Vargas
yes, the point is that I need it to be disabled, but when I try to build the formgroup returns the warnings I put in the post
– veroneseComS
Agendadata: new Formcontrol({value: new Date(), disabled: true}, [Validators.required]) changes there from new to value
– Eduardo Vargas
It worked, if you want to add your answer
– veroneseComS