I have a JSON question line and the answer that binds in ng-repeat, now the problem is that I want to show the question once and all the multiple answers in ng-repeat. this is my data.
{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}
view I show in
<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>
but this connects all the questions several times with an answer like
Q.Your Race White Your Race Q.Your Race African American Your Race Q.Your Race Asian
but i need
Q. Your Race White Your Race African American Your Race Asian
I will be very grateful if anyone can help me with this.
javascript angularjs angularjs-ng-repeat angular-ng-if
Vikas
source share