I am facing an issue with displaying a JSON string of questions and answers in ng-repeat. The problem is that I want to display each question only once, but show all the multiple answers within ng-repeat.
{Answer:"White",AnswerID:967,answer_type:"RADIO",fullquestion:"Your Race",id:6}{Answer:"African American",AnswerID:968,answer_type:"RADIO",fullquestion:"Your Race",id:6}{Answer:"Asian",AnswerID:969,answer_type:"RADIO",fullquestion:"Your Race",id:6}
The current view I have set up is as follows:
<div ng-repeat="hrq in HrqQuestions">
<div class="list card normal">
<div class="item item-body item-divider">
<p ng-bind="hrq.fullquestion"></p>
</div>
<label class="item item-input" ng-show="hrq.answer_type=='FREETEXT'">
<input ng-model="hrq.Answer" name="name" type="text">
</label>
<div ng-if="hrq.answer_type=='RADIO'">
<ion-radio ng-click="selectedAnswer(hrq.AnswerID,hrq.Answer)" name="radio1" ng-value="hrq.AnswerID">{{hrq.Answer}}</ion-radio>
</div>
</div>
</div>
Currently, the questions are being repeated multiple times with different answers, like:
Q.Your Race
White Your Race
Q.Your Race
African American Your Race
Q.Your Race
Asian
However, what I need is:
Q. Your Race
White
African American
Asian
If anyone can help me achieve this structure, I would greatly appreciate it.