Error [$resource:badcfg] with transformrequest/reposnse only in app


Hello whenever I run my app Im getting “errpr [$resource:badcfg] array” it only happens when I run it in the app it works perfectly fine on my desktop and on my phones browser. I think its because of how im using transformresponse because it worked perfectly fine when had my transform via “$httpProvider.defaults.transformResponse.push(mytransform)” but now I just need it on some of my resource endpoints. So I switched to adding “transformResponse: mytransform” to my resource. Here is my code for mytransform

function mytransform(data, headers) {
//check a header and save the data
return data;

I also tried this with beta 9 10 and 11 to rule that out and I’m running it on android 4.4.2 I haven’t tested on an iphone yet.

Also why do I have to wrap my return in angular.tojson(data) for transformRequest when I add it directly to the resource? Is there a way I can push() the transform to the array because I think that might be why I need to return the data a special way.

Anyways any help would be very appreciated thank you.


I found out I was returning the data wrong the correct way is

if (data != "") {
    return angular.fromJson(data)

However I’ve yet to find out how to get the default transforms included. I found the following stackoverflow posts but I couldn’t get it to work yet I’ll let anyone know if I find a better solution though.