I have following code in AngularJS. I am unable to access the original method parameter of 'preference' within the then function of 'updatePreferenceComplete'.
What is the way to access the original parameter of 'preference' in the above then function?
function updatePreference(preferenceId, preference) {
var prefId = angular.isNumber(preferenceId) ? preferenceId : 0;
logger.info('updatePreference: fetching; preferenceId: ' + prefId);
var route = userPreferenceConstants.endPoints.PREFERENCE_BY_ID
.replace('{prefId}', prefId);
return $http.put(route, preference)
.then(updatePreferenceComplete)
.catch(function (message) {
exception.catcher('XHR failed for updatePreference')(message);
});
function updatePreferenceComplete(response) {
//cannot access preference parameter
logger.info('updatePreference: complete');
return response.data;
}
}
variable from funcalert.