Reputation: 1117
This is my code:
$scope.userDetails = function(userId, type) {
ajax.get(orginalData.blockData.USER_BASIC_DETAILS + userId, $scope.getUserDetailsCallBack)
}
$scope.getUserDetailsCallBack = function(result) {
console.log(result)
$scope.empdetails = result.data.record;
}
Here I need to pass type
into callback
method.If I pass like this, am getting Cannot read property 'record' of undefined
error.
$scope.userDetails = function(userId, type) {
ajax.get(orginalData.blockData.USER_BASIC_DETAILS + userId, $scope.getUserDetailsCallBack(type))
}
$scope.getUserDetailsCallBack = function(result, type) {
console.log(result,type)
$scope.empdetails = result.data.record;
}
How to pass it?
Upvotes: 0
Views: 89
Reputation: 701
$scope.userDetails = function(userId, type) {
ajax.get(orginalData.blockData.USER_BASIC_DETAILS + userId, function (result) {
$scope.getUserDetailsCallBack(result, type)
});
}
Upvotes: 2