My problem will for sure seems very simple for some people but I struggle finding a simple solution to achieve this:
In a ngFor loop, I display some items ID and date. On each item i want to add a delete button.
This button is disabled by default and only activated if I tick a checkbox (as a confirmation for deletion).
Here is my code:
<tr *ngFor="let item of itemsArray ">
<td>{{item .date | date:'short'}}</td>
<td>{{item .id}}</td>
<td>Delete?
Yes, Sure: <input type="checkbox">
<br>
<button [disabled]="" (click)="delete(item .id")></button>
</td>
<tr>
On app.component.ts, there is only one variable to go through:
const itemsArray = [
{id: 1, date: 1488170777813},
{id: 2, date: 1488170777813},
{id: 5, date: 1488170777813},
{id: 3, date: 1488170777813},
{id: 4, date: 1488170777813}
];
Delete function is just a http.delete() to remote API.
My question is: how ton bind the checkbox with disable state of my button since i'm inside a loop?
itemsArrayvariable, etc.