nsadreams.blogg.se

Mat input set disabled
Mat input set disabled






mat input set disabled mat input set disabled

It looks like you're using the disabled attribute with a reactive formĭirective. However, if your datepicker is part of a reactive form the text element remains active and you get the following message from Angular: Add the disabled attribute to the input element = A read-only input looks the same as a normal input, but is not editable. The Angular Material docs suggest you disable the text input in the following way: A disabled input is of course also not editable, but it has a distinct appearance - greyed out and looks disabled. There are detailed instructions in the Angular Material 2 docs on how to disable different parts of the mat-datepicker however, these do not seem to cover how to disable the text input when it is part of a reactive form. Include a link to this question if it helps provide context.I am using Angular Material 2's mat-datepicker and want the input element disabled so the user cannot edit the value using the text input. 8 months ago If you have a new question, please ask it by clicking the Ask Question button. apply readonly mode to your form controls (at least for mat-input ones). 8 months, 3 weeks ago Right-click, view source, remove readonly, and you got yourself an editable field again. Our option 1 would be to, in that context, set the form to be disabled which. +1 9 months, 1 week ago This is pretty neat and practical way to solve this issue. Thanks! 3 years, 8 months ago any solution? i have the same problem 3 years, 4 months ago This will not work inside form try another solution like the first one 1 year, 1 month ago Much better approach since readonly doesn't change the color of the text.

3 years, 9 months ago Creating the form group input with it as disabled does the trick. To disable the text field, add the disabled attribute to the element and add the mdc-text-field-disabled class to the mdc-text-field element.

Any idea why? So the problem is maybe made by a different reason. Like the things I googled, it's not working. But you show to much limited code to give a propper answer.

mat input set disabled

And then change this.disabled in true or false. Add the formControlName directive to the editor configuration. 4 months, 3 weeks ago Related Topics html angular angular-material Comments 4 years, 10 months ago All depend what you want and how you set it easiest way is ="disabled". formControlName to read input text element on button click.








Mat input set disabled