Angular Code:
$scope.qA = [ { question : ' question 1', answer: ['answer 1-1', 'answer1-2']},
{ question : ' question 2', answer: ['answer 2-1', 'answer2-2']}];
HTML(jade)代码
h1(ng-repeat='ques in qA.question') {{ques}}
p(ng-repeat='ans in qA[$index].answer']) {{ans}}
在第一次重复重复中,我想从qA中选择“问题”。在第二次重复重复中,我想为所选的“问题”选择每个答案。
以上代码无效。怎么做到呢?
答案 0 :(得分:4)
尝试:
h1(ng-repeat='q in qA') {{ q.question }}
p(ng-repeat='ans in q.answer']) {{ ans }}
答案 1 :(得分:1)
我不知道玉,但这应该像
h1(ng-repeat='ques in qA') {{ques}}
p(ng-repeat='ans in ques.answer']) {{ans}}