i have a scenario where admin from back-end will add questions, i don't know how many, i have to display them all on device and user will choose true false. Now at the end i have to submit these results according to question id.
this is my view code:
<div class="list" ng-repeat="question in questions">
<label class="item item-input item-select">
<div class="input-label">
{{question.Question}}
</div>
<select ng-model="questionID" ng-required="true" ng-options="op as op.name for op in options">
</select>
</label>
<label class="item item-input">
<textarea placeholder="Comments"></textarea>
</label>
{{questionID}} - {{question.ID}} //Test: this is to get selected option, value and question id
</div>
Select Options:
$scope.options = [
{ 'name': 'Select', 'value': '' },
{ 'name': 'True', 'value': '1' },
{ 'name': 'False', 'value': '0' }
];
Finally i have to make these all like:
"Questions": [
{
"QuestionID": 1,
"Answer": 1,
"Comment" : "Some Comments"
},
{
"QuestionID": 2,
"Answer": 0,
"Comment" : "Some Comments"
}
]
please advise. Thanks