您好我正试图出现2个菜单
点击"事件"按钮
这里的问题是单个菜单中的1)和2)显示虽然两个htmls都不同。我哪里错了。下面是代码。
HTML:
<div class="tab" >
<div class="sidebar-top">
<ul class="nav nav-pills nav-justified">
<li class="active"><a href="#1a" data-toggle="tab">Event</a></li>
<li><a href="#2a" data-toggle="tab">Date</a></li>
</ul>
</div>
<div class="tab-content clearfix">
<div class="tab-pane active" id="1a">
<ul class="nav nav-sidebar">
<li class=" nav-active active"><a href="dashboard.php"><i class="icon-home"></i><span>Dashboard</span></a></li>
<li class="nav-parent" ng-repeat="(key, value) in getdatewasedetails | groupBy: 'depatName'">
<a href="#"><i class="fa fa-link"></i><span></span>{{ key }} <span class="fa arrow"></span></a>
<ul class="children collapse" ng-repeat="subdept in value">
<li ><a href="#"> {{ subdept.serviceName }} </a></li>
</ul>
</li>
</ul>
</div>
<div class="tab-pane" id="2a">
<ul class="nav nav-sidebar">
<li class=" nav-active active"><a href="dashboard.php"><i class="icon-home"></i><span>Dashboard</span></a></li>
<li class="nav-parent" ng-repeat="(key, value) in getdatewasedetails| groupBy: 'month'">
<a href="#"><i class="fa fa-link"></i><span></span>{{ key | date:'MMMM' : 'UTC' }} <span class="fa arrow"></span></a>
<ul class="children collapse" ng-repeat="currDates in value">
<li ><a href="#"> {{currDates.testDate | date:'longDate' : 'UTC'}} </a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
导致Json:
Angular JS:
$scope.lastVisit = function () {
var request = $http({
method: "get",
url: "dashboardServiceCall.php",
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
});
/* Successful HTTP get request or not */
request.success(function (data, status, headers, config) {
z=0;
for(var x=0; x < data.length; x++){
if(data[x]['type'] == 3){
for(var g=0; g<data[x]['data']['dateWaseReportResForTests'].length; g++){
$scope.getdatewasedetails[z] = data[x]['data']['dateWaseReportResForTests'][g];
$scope.getdatewasedetails[z].testDate = new Date($scope.getdatewasedetails[z].testDate);
$scope.getdatewasedetails[z].category = data[x]['data']['panelName'];
$scope.getdatewasedetails[z].month = $scope.getdatewasedetails[z].testDate.getMonth();
z++;
}
for(var y=0; y<data[x]['data']['dateWaseReportResForGroups'].length; y++){
for(var d=0; d< data[x]['data']['dateWaseReportResForGroups'][y]['data']['dateWaseReportResForTests'].length; d++){
$scope.getdatewasedetails[z] = data[x]['data']['dateWaseReportResForGroups'][y]['data']['dateWaseReportResForTests'][d];
$scope.getdatewasedetails[z].testDate = new Date($scope.getdatewasedetails[z].testDate);
$scope.getdatewasedetails[z].category = data[x]['data']['panelName'];
$scope.getdatewasedetails[z].month = $scope.getdatewasedetails[z].testDate.getMonth();
z++;
}
}
}else if(data[x]['type'] == 1 ){
for(var g=0; g<data[x]['data']['dateWaseReportResForTests'].length; g++){
$scope.getdatewasedetails[z] = data[x]['data']['dateWaseReportResForTests'][g];
$scope.getdatewasedetails[z].testDate = new Date($scope.getdatewasedetails[z].testDate);
$scope.getdatewasedetails[z].category = data[x]['data']['dateWaseReportResForTests'][g]['serviceName'];
$scope.getdatewasedetails[z].month = $scope.getdatewasedetails[z].testDate.getMonth();
z++;
}
}else if(data[x]['type'] == 2){
for(var y=0; y<data[x]['data']['dateWaseReportResForGroups'].length; y++){
for(var d=0; d< data[x]['data']['dateWaseReportResForGroups'][y]['data']['dateWaseReportResForTests'].length; d++){
$scope.getdatewasedetails[z] = data[x]['data']['dateWaseReportResForGroups'][y]['data']['dateWaseReportResForTests'][d];
$scope.getdatewasedetails[z].testDate = new Date($scope.getdatewasedetails[z].testDate);
$scope.getdatewasedetails[z].category = data[x]['data']['dateWaseReportResForGroups'][y]['data']['groupName'];
$scope.getdatewasedetails[z].month = $scope.getdatewasedetails[z].testDate.getMonth();
z++;
}
}
}
}
$scope.leftNavMenu = $scope.getdatewasedetails;
});
}
以上两个图像显示输出。两次重复渲染。我不知道我哪里出错了。任何帮助都会很棒。提前谢谢。