I'm new to angularjs and i have trouble accessing a scope variable of a function from another function.
1st function
$scope.getCustomer = function (customer_id) {
ABCServices.wts.customer.customerList({customerId:customer_id}).then(function (data) {
console.log("^^^^^ABC show^^^^^");
$scope.wtsdata = data;
console.log($scope.wtsdata);
});
};
So here i want to access $scope.wtsdata
in my second function. When i try to access it it gives me a undefined error.How to do this?
2nd function
$scope.selectCustomer = function (item) {
$scope.item = item;
if (item.length === 8) {
$scope.getCustomer(item);
console.log("Check"+$scope.wtsdata);
}
};