I am populating a java script array with values and when I try to access them I am getting undefined array. Does the array have different scope or? In the first console.log the array is OK in the second is undefined.
var pdfEditArray = new Array();
$scope.previewPdf = function () {
getForamatedPdf(fileName, $scope.pdfVertical, $scope.pdfHorisontal, $scope.pdfControl.ControlText).then(function (response) {
pdfEditArray.push({ pdfId: '1', controlId: '2', pageNumber: '3', vertical: '4', horisontal: '5' });
})
console.log(pdfEditArray);
}
$scope.savePdfFormat = function (pdfEditArray) {
console.log(pdfEditArray);
}