Hi what i am trying is i am trying to create a dynamic table with input using row span here
requirement:
I have 2 fields in the table username & email * inputs . I can enter what ever text i want inputs. after that when ever i press getTableValue button then i need to retrieve all the inputs values and along with that corresponding username value and i need to create json here username will be the key and what ever i enter in that input will be the values.
suppose my username is bret and in the input i entered avenger and in json it needs to be
{
"bret":"avenger"
}
I tried the reactive form but unable to get the values below is my code
<div>
<button type="button" (click)="getTableValue()">Get Value </button>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>username</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of dynamicData; let i = index">
<td>{{ data.username }}</td>
<td>{{ data.email }}</td>
<td [attr.rowspan]="5" *ngIf="i % 5 == 0">
<input type="text" />
</td>
</tr>
</tbody>
</table>
</div>
below is my stackblitz url ==> https://stackblitz.com/edit/angular-ivy-drfozo?file=src/app/app.component.ts