I have crated angular application for examination in which user gives exam and finally show full report with selected answer I have used ng-repeat for radio button to show options and I want to show user has selected answer and corrected answer if user has selected wrong than its should be red else green but it I have checked using conditions but it changing all radio button colors here is code
<div class="md-radio"
data-ng-repeat="data in vm.examQuestions.allOptions track by $index"
ng-class="{correct:vm.examQuestions.attemptQuestions.yourChoice === vm.examQuestions.correctanswer ||
vm.examQuestions.correctanswer === vm.optionsArr[$index],
'has-error':vm.examQuestions.attemptQuestions.yourChoice !== vm.examQuestions.correctanswer}">
<span class="lblOption"></span>
<input type="radio" id="" name="radio" class="md-radiobtn"
ng-model="vm.examQuestions.attemptQuestions.yourChoice"
ng-value="vm.optionsArr[$index]"
ng-disabled="true">
<label for="">
<span class="inc"></span>
<span class="check"></span>
<span class="box"></span>
<label ng-if="'string' === vm.checkOptionString(data);"></label>
<img ng-src="" ng-if="'URL' === vm.checkOptionString(data);" width="40px">
</label>
can someone tell me how to apply color only to specific radio button if user has selected right or wrong options
thanks in advance
Source: AngularJS
from Angular Questions https://angularquestions.com/2017/09/30/how-to-change-only-specific-color-of-radio-button-in-angular/
via @lzomedia #developer #freelance #web #lzomedia.com
No comments:
Post a Comment