Reputation: 487
Hi I have some angular code that utilises $resource to call a web api and get back some data. All works fine until the dataset being returned from the api gets over a few thousand rows. I get a really unhelpful error as detailed below:
Error: [$resource:badcfg] array http://errors.angularjs.org/1.2.28/$resource/badcfg?p0=object
I'm calling with GET, isArray: true and with some headers which just contain dates.
Anyone encountered this sort of problem?
Upvotes: 0
Views: 161
Reputation: 74
The error indicates that the $resource complained that your api returned something it doesn't like. In this case, the api returned an object when $resource expected array.
If you are making request and expect an object, you should use {method:'GET'}
using {method:'GET', isArray:true} only when you are expecting an array
You are getting an object {} back from your api, so you should not have "isArray:true"
Upvotes: 1