私はng-repeat
を使ってJsonデータにしようとしています。しかし、Webページは、白いページまたは空白のページとして表示されています。ng-repeatを使用してjsonデータを表示する方法は?
JSON:
{
"questions": {
"q1": {
"qText": " question1",
"result":"result1",
"options":{
"A":"option1",
"N":"option2",
"D":"otpion3",
"NA":"option4"
}
},
"q2": {
"qText": " question2",
"result":"result2",
"options":{
"A":"option1",
"N":"option2",
"D":"otpion3",
"NA":"option4"
}
},
"q3": {
"qText": " question3",
"result":"result3",
"options":{
"A":"option1",
"N":"option2",
"D":"otpion3",
"NA":"option4"
}
},
"q4": {
"qText": " question4",
"result":"result4",
"options":{
"A":"option1",
"N":"option2",
"D":"otpion3",
"NA":"option4"
}
},
"q5": {
"qText": " question5",
"result":"result5",
"options":{
"A":"option1",
"N":"option2",
"D":"otpion3",
"NA":"option4"
}
},
"q6": {
"qText": " question6",
"result":"result6",
"options":{
"A":"option1",
"N":"option2",
"D":"otpion3",
"NA":"option4"
}
}
}
}
}
HTML:ご質問がオブジェクトかどうか
<div ng-repeat="question in questions track by $index">
<div class="q1">
<p>{{question.qText}}</p>
<input type="radio" ng-model="qobj.q1" ng-value="'A'" ><label>{{question.options.A}}</label>
<input type="radio" ng-model="qobj.q1" ng-value="'N'" ><label>{{question.options.N}}</label>
<input type="radio" ng-model="qobj.q1" ng-value="'D'" ><label>{{question.options.D}}</label>
<input type="radio" ng-model="qobj.q1" ng-value="'NA'" ><label>{{question.options.NA}}</label>
</div>
</div>
あなたの質問は? –
onclick submitすべての入力値を取得し、オブジェクトに格納する方法は? –