我有一個JSON字符串的問題和答案在ng-repeat中綁定, 現在問題是我想在ng-repeat中顯示問題一次和所有多個答案。 這是我的數據。檢查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}
觀點我顯示在
<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>
但這種結合的所有問題與答案多次像
Q.Your Race
White Your Race
Q.Your Race
African American Your Race
Q.Your Race
Asian
,但我需要一個像
Q. Your Race
White Your Race
African American Your Race
Asian
我會非常感謝任何人都可以幫助我h該
一個想法是改變HrqQuestions對象到你想要的格式。 – Ruhul