Answer the question
In order to leave comments, you need to log in
How to change the value of multiple fields in AngualarJS?
There is a Json object:
{
"id": 1,
"question": "Текст вопроса?",
"answers": [
{
"id" : 1,
"answer": "aaa",
"isSelected" : 0
},
{ "id" : 2,
"answer": "bbb",
"isSelected" : 0
},
{ "id" : 3,
"answer": "ccc",
"isSelected" : 0
},
{ "id" : 4,
"answer": "ddd",
"isSelected" : 0
}
],
"allowMultipleChoice" : true
}
Answer the question
In order to leave comments, you need to log in
self.answers = [{...}]
self.currentAnswer = null
self.onSelectAnswer = function (answer) {
self.currentAnswer.isSelected = true
answer.isSelected = true
self.currentAnswer = answer
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question