var myApp = angular.module('myApp',[]); myApp.controller('GreetingController', ['$scope', function($scope) { $scope.questions = [ { "Active": true, "Comments": false, "DecimalPlaces": 0, "F": false, "FP": false, "Grouped": null, "ID": 20500, "Length": false, "MP": true, "Multiline": false, "Number": 45, "NumericOnly": false, "Optional": false, "Question": "How long ago was the treatment?", "QuestionID": 45, "QuestionSectionID": 2, "QuestionTypeID": 2, "QuestionnaireID": 298, "ReliesOnAnswer": true, "ReliesOnID": 10, "Weight": false, "Answer": '2 years ago' }, { "Active": true, "Comments": false, "DecimalPlaces": 0, "F": false, "FP": false, "Grouped": null, "ID": 20500, "Length": false, "MP": true, "Multiline": false, "Number": 45, "NumericOnly": false, "Optional": false, "Question": "Who is God of cricket?", "QuestionID": 45, "QuestionSectionID": 2, "QuestionTypeID": 2, "QuestionnaireID": 298, "ReliesOnAnswer": true, "ReliesOnID": 20, "Weight": false, "Answer": 'Sachin Tendulkar' } ]
.show { display: block; } .hide { display: none; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> <div ng-app="myApp" ng-controller="GreetingController"> <div ng-repeat="question in questions track by $index"> {{question.Question}} <input type="radio" name="Flag_{{$index}}" ng-click="flagChange($event)" data-value="yes" data-reli-id='{{question.ReliesOnID}}' />Yes <input type="radio" name="Flag_{{$index}}" ng-click="flagChange($event)" data-value="no" data-reli-id='{{question.ReliesOnID}}' />No <span ng-show="custom_$index">{{question.Answer}}</span> <br/> <div id="{{question.ReliesOnID}}" class="hide"> Question based on ReliesOnID : {{question.ReliesOnID}} </div> <br/> </div> </div>