Angular-Wordpress-Theme
Angular-Wordpress-Theme copied to clipboard
How to refactor this Angular code to fix the $resource:badcfg error
Hi Roy,
I have been following your SPA with Angular and WordPress and I hit a wall when I get to adding custom data to the API response and displaying it. When I add register_api_field()
to function register_new_field()
I get this error:
Error: [$resource:badcfg]
This error is saying that $resource expects an array, but its getting an object. I do have Posts.query() in the first wpApp.controller(), but when I change Posts.query()
to Posts.get()
that did not change anything and Posts.query()
is what you have in the tutorial.
I have the code I am working with here in my repo: https://github.com/ldco2016/angular-spa
How do I write this to eliminate this bug?