I have one function, I am required to print the lastlockerbalance outside the function.
var getlockerbalance = function() {
$http.get("php/selectLOCKERBALANCE.php").success(function(lockerbalance) {
$scope.lockerbalance1 = lockerbalance;
var lastlockerbalance = $scope.lockerbalance1[0].LOCKERBALANCE;
console.log(lastlockerbalance);
});
};
console.log(lastlockerbalance);
Showing error message as "lastlockerbalance is undefined".