I want to apply the following transformation to all responses... I can do it one by one, but I have dozens.. so there must be a way to do it globally? I tried injecting it, but I get all sort of errors.
transformResponse: function (data) {
var wrappedResult = angular.fromJson(data);
return wrappedResult.records;
}
I am assuming is wrapping it here.. but I can't figure it out how.
bme.factory('envelopInterceptor', [function () {
return {
};
}]);
I remember this piece of code and its source (The author gives an example to parse dates)
myApp.config(["$httpProvider", function ($httpProvider) {
$httpProvider.defaults.transformResponse.push(function(responseData){
transformYourResponse(responseData);
return responseData;
});
}]);