Project -> Active Configuration -> Debug | iPhoneSimulator
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script>
var app = angular.module('year', []);
app.controller('customersCtrl', function($scope, $http) {
$http.get("year.php")
.then(function (response) {
$scope.years = response.data.years;
var ids = [];
var havedata = [];
for ( var i = 0 ; i < $scope.years.length; i++) {
ids.push($scope.years[i]["id"]);
$http.get("book.php?id="+$scope.years[i]["id"]+"").then(function (response) {
books = response.data.yearbooks ;
if (response.data.yearbooks.length == 0 )
{
var check = 0 ;
for(var t = 0 ; t < ids.length ; t++)
{
for(var n = 0 ; n < havedata.length ; n++)
{
if(ids[t] == havedata[n])
{
check = 1 ;
break;
}
else
{
check = 0 ;
}
}
if (check == 0)
{
$scope["yearbook"+ids[t]] = response.data.yearbooks ;
}
}
}
else
{
$scope["yearbook"+books[0]["year"]] = response.data.yearbooks ;
console.log(books[0]["year"]);
havedata.push(books[0]["year"]);
}
});
}
console.log($scope);
});
});
</script>
**如何让
<div class="panel-group" id="accordion2" role="tablist" aria-multiselectable="true"
ng-app="year" ng-controller="customersCtrl">
<div class="panel panel-default" ng-repeat="y in years" >
<div class="panel-heading" role="tab" id="headingTwo" >
<h4 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#accordion2" href="#collapse11{{ y.id }}" aria-expanded="true" aria-controls="collapse11">
{{ y.Name }}
</a>
</h4>
</div>
<div id="collapse11{{ y.id }}" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="heading22">
<div class="panel-body" >
<ul >
<li ng-repeat="x in yearbook">
{{ x.Name }}
</li>
</ul>
</div>
</div>
</div>
</div>
动态的年鉴获得价值**
我认为这一点上的错误但我不知道如何解决它
<li ng-repeat="x in yearbook">
[这是我将年鉴改为年鉴3时的成功输出]
when i change yearbook to yearbook3
我必须做些什么,请帮助我