Reputation: 491
<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?
Upvotes: 0
Views: 75
Reputation: 683
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>
Upvotes: 0
Reputation: 188
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>
Upvotes: 1