1<input [disabled]="condition ? true : false">
2<input [attr.disabled]="condition ? 'disabled' : null">
1 // component.ts
2
3 @Component({
4 templateUrl: 'component.html',
5 selector: 'app-component',
6 })
7 export class Component {
8 name = 'Peter';
9
10 updateName() {
11 this.name = 'John';
12 }
13 }
14 // component.html
15
16 <p>My name is {{name}}</p>
17 <button (click)="updateName()">Update button</button>