Hayy all i have some problem in ng-repeat i want ask this code in snippet.
okey so i try to show all data,
1. i show the name with ng-repeat-start.
2. i show the questions with ng-repeat and
3. i show the answear with ng-repeat again
and the problem is, after i try ng-repeat in the step 3 for the show answears why the name and questions not show? and how to show this all data??
1. name/title // in this code not showing => must show
2. the Questions // in this code not showing => must show
3. Answears => 1 2 3 4 5 // is showing
thanks
var $scope;
var app = angular.module('miniapp', []);
function Ctrl($scope) {
$scope.instructors = [{
id: 1,
name:"A",
questions:[
{"ask":"what is apple?"},
{"ask":"what is apple1?"},
{"ask":"what is apple2?"}
]
}, {
id: 2,
name:"B",
questions:[
{"ask":"what is pier?"},
{"ask":"what is pier1?"},
{"ask":"what is pier2?"}
]
}
, {
id: 3,
results:[
1,2,3,4,5,6,7,8,9,10
]
}
];
}
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
tr:nth-child(even) {
background-color: #dddddd;
}
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.10/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<div ng-app="miniapp">
<div ng-controller="Ctrl">
<table class="table table-striped table-border">
<!-- <thead style="border-style:1px black"> -->
<tr>
<!-- <th>NO</th> -->
<th>Title</th>
<th>#</th>
<th>Question</th>
<th>1</th>
<th>2</th>
<th>3</th>
<th>4</th>
<th>5</th>
</tr>
<!-- </thead> -->
<!-- <tbody> -->
<tr ng-repeat-start="DataQuest in instructors">
<tr ng-repeat="a in DataQuest.questions">
<tr ng-repeat="b in DataQuest.results track by $index">
<td ng-if="!$first"></td>
<td ng-if="$first">{{DataQuest.name}}</td>
<td>{{$index + 1}}</td>
<td>{{a.ask}}</td>
<td>{{b}}</td>
<td>{{b}}</td>
<td>{{b}}</td>
<td>{{b}}</td>
<td>{{b}}</td>
<tr ng-repeat-end></tr>
</tr></tr>
<!-- </tbody> -->
</table>
</div>
</div>
</tr>tag, instead ofng-repeat-startuseng-repeatand instead<tr ng-repeat-end></tr>replace with</tr>.