0
<div *ngFor="let reply of repliesForm?.get('replies')?.value; let i = index;">
    <div [innerHTML]="reply.body"></div>
    <textarea formControlName="reply.body"></textarea>
</div>

The innerHTML is set fine but how do I get the formControlName to bind to the textarea?

IAfanasov
  • 4,775
  • 3
  • 27
  • 42
Gordon Hickley
  • 491
  • 1
  • 7
  • 17

2 Answers2

1

I think you should change your loop like this. Because you can access both value and control.

<div *ngFor="let replyControl of repliesForm?.get('replies'); let i = index;">
    <div [innerHTML]="replyControl.value.body"></div>
    <textarea [formControl]="replyControl"></textarea>
</div>
HungCung
  • 188
  • 1
  • 2
  • 9
0

I think this will work fine for you

<div *ngFor="let reply of repliesForm?.get('replies')?.value; let i = index;">
  <div [innerHTML]="reply.body"></div>
  <textarea formControlName="{{reply.body}}"></textarea>
</div>