I am trying to populate some questions with some dynamic answers, but it isn't working for me.
Everything works fine but I don't understand how to get this dynamic radio button value with a question like :
General Assessment of the Programme:Good
Quality of the Material Provided:Excellent
Design of the Programme:Excellent
How do I get this data?
HTML
<table class="table table-bordered" *ngFor="let item of QuestionMaster.Questions let i=index">
<tr>
<td colspan="5">
<h5><b>{{i+1}}. {{item.question1}}</b></h5>
</td>
</tr>
<tr>
<td align='center' valign="center" *ngFor="let items of QuestionMaster.Ratings let i=index">
{{items.description}}
</td>
</tr>
<tr>
<td align='center' *ngFor="let items of QuestionMaster.Ratings let i=index">
<input type="radio" id="{{items.rateno}}" name="{{item.rowid}}" />
</td>
</tr>
</table>
json
{
"Questions": [
{ "quid": 1, "question1": "General Assessment of the Programme ", "rowid": 1 },
{ "quid": 2, "question1": "Quality of the Material Provided ", "rowid": 2 },
{ "quid": 3, "question1": "Design of the Programme ", "location": "Pune", "username": "mdppune", "rowid": 3 },
...
],
"Ratings": [
{ "rateid": 1, "rateno": 1, "description": "Poor" },
{ "rateid": 2, "rateno": 2, "description": "Fair"},
{ "rateid": 3, "rateno": 3, "description": "Good"},
{ "rateid": 4, "rateno": 4, "description": "Very Good"},
{ "rateid": 5, "rateno": 5, "description": "Excellent"}
]
}
(ngModelChange)="onSelect($event)". In your componentonSelect(val) {//retrieve your value}get diagnostic() { return JSON.stringify(this.model); }. In the second case, you can subscribe to the change event :this.yourForm.valueChanges .subscribe(data => { this.output = data })