I have a list that requires ngFor, so far so good, each item needs an input with a button that does something with the value of the input.
<mat-list role="list">
  <mat-list-item *ngFor="let item of items">{{item}}: 
    <mat-form-field>
      <input matInput>
    </mat-form-field>
    <button mat-stroked-button (click)="addCookie()">Add Cookie</button>
  </mat-list-item>
</mat-list>
Check https://stackblitz.com/edit/angular-lpiakc?file=app%2Flist-overview-example.ts
How can I pass the value of the input to the method addCookie?
export class ListOverviewExample {
  items = ['item 1', 'item 2', 'item 3'];
  addCookie() {
    console.log("here I would like to paste the value of the input field");
  }
}
 
    