Created a table in angular containing car names. Each raw contains a reorder button, input field, and an edit button. Values in the input fields were populated using *ngFor. Initially all the input fields are disabled. When I click the edit button, then the corresponding input field needs to be enabled. But here all the input fields are enabled. I have gone through so many questions were asked. But could not find any solution. It would be helpful if someone can help. Thanks in advance. html
<table mat-table width="1500">
<tr>
<th>Cars</th>
<td>
<ul *ngFor='let car of Car'>
<li >
<button mat-icon-button color="Green">
<mat-icon>reorder</mat-icon>
</button>
<input mat-input #a id={{car.id}} value={{car.name}} class="text- width"
[disabled]=is_edit>
<button mat-icon-button color="Green" (click)="isDisable()">
<mat-icon>edit</mat-icon>
</button>
</li>
</ul>
</td>
</tr>
</table>
.ts file
export class CarComponent implements OnInit {
is_edit: boolean;
public Car: any[] = [{ id: '1', name: 'Maruti' }, { id: '2', name: 'Volkswagen' }, { id: '3', name: 'Ford' }];
public ngOnInit(): void {
this.is_edit = true;
}
public isDisable(): void {
this.is_edit = false;
}
}