Is there a way to retrieve the text area value and pass it when a button is clicked?
<form novalidate [formGroup]="simulationForm">
<div formArrayName="answer_key" *ngFor="let other of simulationForm.get('answer_key').controls; let i = index" class="form-group">
<div [formGroupName]="i" class="mat-form-field--inline">
{{i + 1}}.
<mat-form-field>
<textarea matInput placeholder="Sentence" id="sentence" formControlName="sentence" readonly="true"></textarea>
</mat-form-field>
<button class="btn btn-success" type="button" (click)="openDialog()">Add</button>
</div>
</div>
</form>
Trying to send the sentence value from each row when the respective button is clicked.
For instance,
(click)="openDialog(simulationForm.get('sentence').value)"
Alternatively, you could try
(click)="openDialog(simulationForm.get('answer_key').controls['sentence'].value)"