I am making a quiz app, as a beginner i facing some problem, I making quiz with more questions and answer in a page like this
1) question ...
a) answer 1 b) answer 2 c) answer 3
2) question ...
a) answer 1 b) answer 2 c) answer 3
Now I want to change background color when a answer will select I have used nested repeat to show the question's and answer here my code
Html
<section class="quiz_section" ng-controller="quizctrl as quizs">
<div class="quiz_part" ng-repeat="quiz in quizs.data">
<div class="container">
<div class="row no-gutter">
<div class="col-12">
<div class="quiz_title">
<h2><span class="quiz_num">Q{{$index+1}}</span> {{quiz.text}} </h2>
</div>
<div class="quiz_desc">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris dui ipsum, fermentum eget vehicula sit amet, suscipit quis justo. Maecenas sagittis aliquet magna ac ultrices. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nullam ac maximus arcu. </p>
</div>
</div>
</div>
<div class="row no-gutter">
<div class="col-lg-2 col-sm-4" ng-repeat="quizanswer in quiz.possibilities">
<label class="answer"
ng-class="{'bg-info': $parent.$index === quizanswer.activeQuestion }"
ng-click="selectAnswer($parent.$index)">
{{quizanswer.answer}}
</label>
</div>
<div class="col-lg-2 col-sm-4 last">
<input type="submit" value="submit">
</div>
</div>
</div>
</div>
</section>
js
var app = angular.module('myapp');
app.controller('quizctrl', QuizCtrl);
QuizCtrl.$inject = ['QuizData'];
function QuizCtrl(QuizData){
var vm = this;
vm.data = QuizData.quizQuestions;
vm.activeQuestion = 0;
vm.selectAnswer = selectAnswer;
function selectAnswer(index){
vm.activeQuestion = index;
}
}
so i want to insert bg-info class to the answer when click please help