Reputation: 11
I need best option to disabled input matInput type filed in Angular Material? Check my code:
<div></mat-label>
</div>
Upvotes: 0
Views: 1594
Reputation: 1892
You can disable the formControl in your controller.
Say I have a Form Group
called myForm
which contains a control called name
.
You can set the disabled
to true
when initializing the form.
const myForm = this.formBuilder.group({
name: [{value:'',disabled: true}]
})
Or you can dynamically disable control using:
myForm.get('name').disable();
Upvotes: 2