angular.module(" orgTools")。控制器(" AndroidStatsCtrl",功能($ scope){
var selectedApp= null;
var PerAppDetails= null;
$scope.allAppDetails= [];
$scope.perAppStat= PerAppDetails;
$scope.allAwApps=awAppCategories;
$scope.processStart=false;
$scope.allAppsPresent =allApps;$scope.showContent = function($fileContent){
$scope.allAppDetails.push.apply($scope.allAppDetails,
processFile($fileContent));
getAllAppCategories($scope.allAppDetails);
selectedApp= null;
showLoadGif("loadgifBatteryStat","id","hide");
$scope.allAWApps=awAppCategories;
$scope.allAppsPresent=allApps;
};
$scope.isSelected= function(appSel){
return selectedApp===appSel?"btn-primary":"";
}
//在此函数内部,当我从ng-click使用它时,变量//$scope.allAppDetails变为空。
$scope.selectApp = function (newAppSel) {
selectedApp = newAppSel;
for(item in $scope.allAppDetails)
{
if(allAppDetails[item].name===newAppSel)
appDetails=allAppDetails[item];
}
}