I want to get the value of the radio button from each row as in the below screenshot from HTML to TypeScript.
<form [formGroup]="feedbackForm" (ngSubmit)="submitData()">
<table class="res-tbl">
<thead style="background-color: #f6f9fc;">
<tr>
<th class="table-head"></th>
</tr>
</thead>
<tbody>
<tr class="skill-tr" *ngFor='let skill of skills; let i = index;'>
<td class="skill-td">
<b>{{skill.skillName}}<span>:</span></b>{{skill.description}}
</td>
<td>
<mat-radio-group formControlName="resourceRating" name="ratingId{{i}}" >
<span class="radio-span">0</span><mat-radio-button class="radio-btn" value="0"></mat-radio-button>
<span class="radio-span">1</span><mat-radio-button class="radio-btn" value="1"></mat-radio-button>
<span class="radio-span">2</span><mat-radio-button class="radio-btn" value="2"></mat-radio-button>
<span class="radio-span">3</span><mat-radio-button class="radio-btn" value="3"></mat-radio-button>
<span class="radio-span">4</span><mat-radio-button class="radio-btn" value="4"></mat-radio-button>
</mat-radio-group>
</td>
</tr>
</tbody>
</table>
<button>Submit</button>
</form>
export class FeedbackFormComponent implements OnInit {
resourceRating:[];
ngOnInit(): void {
this.ratings = this.ratingService.getAllRatings();
console.log(this.ratings);
this.skills = this.skillService.getAllSkills();
this.feedbackForm = this.fb.group({
applicantId:[''],
positionId:[''],
comments:[''],
recommendation:[''],
resourceRating:['']
[this.fb.array([
this.fb.group({
skillId:[''],
ratingId:['']
})])]
});
}
submitData(){
console.log('feedbackForm',this.feedbackForm);
this.resFeedbackService.createResourceFeedback(this.feedbackForm.value);
}
}