jeffsebring / angular-wp-api

An AngularJS Client for WP-API
124 stars 15 forks source link

ReferenceError: wpAPIData is not defined #13

Closed ghost closed 2 years ago

ghost commented 9 years ago

Hi, I'm trying to utilize angular-wp-api, and have some issue with 'wpAPIData'. I read your answer to @joao-parana, but still not fully understand the way of solution. I already added within my wordpress json-rest-api/plugin.php the code you specified as is, but not sure where to add the theme support for 'angular-wp-api' ?? then on running angular app the ctrl recognized 'wpAPIResource' but not 'wpAPIData' obj, receiving this error: ReferenceError: wpAPIData is not defined

.controller('SliderCtrl',function($scope, $timeout, $ionicSlideBoxDelegate, $http, wpAPIResource, wpAPIData) { ... }

where is the mistake?

jeffsebring commented 9 years ago

Have a look at this section of the docs - https://github.com/jeffsebring/angular-wp-api#set-theme-support

It makes reference to add_theme_support https://codex.wordpress.org/Function_Reference/add_theme_support, which is necessary for the plugin to run. This plugin does nothing (including create your missing object) if you have not set it's theme support from either your theme, a plugin, or mu-plugin.

brianlmerritt commented 9 years ago

I don't believe you should have a reference to wpAPIData. When I put that in (following this example) I had an error because wpAPIDataProvider was missing. When I removed the reference but kept in wpAPIResource it worked fine.