i have this function:
charCtrl.loadDataFromToMonth= function (from,to,year) {
var url = servername+'admin/dashboard/getIncidentDepartByMonthFromTo/'+from+'/'+to+'/'+year;
//alert(url);
function onSuccess(response) {
console.log("+++++getIncidentDepartByMonthFromTo SUCCESS++++++");
if (response.data.success != false) {
$scope.payloadgetIncidentDepartByMonthFromTo = response.data.data;
var getIncidentDepartByMonthFromTo= $scope.payloadgetIncidentDepartByMonthFromTo;
// alert('dddd'+JSON.stringify(loadedDataByMission));
$scope.labelsf = [];
$scope.qsd = [];
$scope.dataf = [];
getIncidentDepartByMonthFromTo.forEach(function(data) {
var monthNumber=$filter('date')(data.la_date, "MM");
$scope.labelsf.push($filter('monthName')(monthNumber));
$scope.dataf.push(data.number);
$scope.qsd.push('ff','ff','ff');
//alert($scope.labelsf );
});
//alert( $scope.dataf );
charCtrl.loadDataFromToMonthArrivee(from,to,year);
} else {
alert("failure");
}
// $scope.stopSpin('spinner-0');
};
function onError(response) {
console.log("-------getIncidentDepartByMonthFromTo FAILED-------");
//$scope.stopSpin('spinner-0');
console.log(response.data);
console.log("Inside getIncidentDepartByMonthFromTo error condition...");
};
//----MAKE AJAX REQUEST CALL to GET DATA----
ajaxServicess.getData(url,username,password, 'GET', '').then(onSuccess, onError);
};
this function return for exemple: $scope.dataf = ['45','48','255'];
I have a second function, by the way its the same function but it gets data from other Rest service:
charCtrl.loadDataFromToMonthArrivee= function (from,to,year) {
var url = servername+'admin/dashboard/getIncidentArriveeByMonthFromTo/'+from+'/'+to+'/'+year;
//alert(url);
function onSuccess(response) {
console.log("+++++getIncidentDepartByMonthFromTo SUCCESS++++++");
if (response.data.success != false) {
$scope.payloadgetIncidentArriveeByMonthFromTo = response.data.data;
var getIncidentArriveeByMonthFromTo= $scope.payloadgetIncidentArriveeByMonthFromTo;
// alert('dddd'+JSON.stringify(loadedDataByMission));
$scope.labelsf = [];
$scope.qsd = [];
$scope.dataf = [];
getIncidentArriveeByMonthFromTo.forEach(function(data) {
var monthNumber=$filter('date')(data.la_date, "MM");
$scope.labelsf.push($filter('monthName')(monthNumber));
$scope.dataf.push(data.number);
//$scope.qsd.push('ff','ff','ff');
//alert($scope.labelsf );
});
alert('aqsz'+$scope.dataf );
} else {
alert("failure");
}
// $scope.stopSpin('spinner-0');
};
function onError(response) {
console.log("-------getIncidentDepartByMonthFromTo FAILED-------");
//$scope.stopSpin('spinner-0');
console.log(response.data);
console.log("Inside getIncidentDepartByMonthFromTo error condition...");
};
//----MAKE AJAX REQUEST CALL to GET DATA----
ajaxServicess.getData(url,username,password, 'GET', '').then(onSuccess, onError);
};
this function return for exemple: $scope.dataf = ['69','50','96'];
my question is: is there a way to declare the second function in the first fuction and get a result like this: this function return for exemple: $scope.dataf = [['45','48','255'],['69','50','96']];