Bind to [disabled] Attribute
You can bind the disabled attribute to an Angular expression, which could be a true or false value.
Example:
<input [disabled]="isDisabled" type="text" placeholder="Enter your text here">
<button click="toggleDisable()">Toggle Disable</button>
Component Code:
import { Component } from'@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['styles/app.component.css']
}
export class AppComponent {}
isDisabled: Boolean = false;
toggleDisable() { this.isDisabled = !this.isDisabled }