I'm just getting started with ember, and working on an ember.js app which loads it's data store from a Wordpress blog, which is running the JSON REST API plugin.
The API has a namespace of 'wp-json.php', and uses these conventions.
Issue I:
I'm getting the error Error while loading route
once I try to setup the DS.RESTAdapter, and load the model.
Issue II:
I'm trying to pass the header "type": "custom_post_type_slug"
, in order to get the data of a custom post type, and can't get that to work either.
Here is my code:
App = Ember.Application.create({ }); //Create App
//Router
App.Router.map(function () {
this.resource('posts', {path: '/'}, function() {
this.resource('post', { path: ':post_id' } );
});
}); //End Router
//Posts Route
App.PostsRoute = Ember.Route.extend({
model: function(){
return this.store.find('post');
},
});
//Data
App.Post = DS.Model.extend({
title : DS.attr('string'),
});
App.PostAdapter = DS.RESTAdapter.extend({
host: 'http://example.com',
namespace: 'wp-json.php'
});
DS.RESTAdapter.reopen({
headers: {
"type": "custom_post_type_slug"
}
});
Any pointers would be greatly appreciated!
[Debug] Transition #1: posts: handling error: TypeError: 'undefined' is not an object (evaluating 'factory.store = this') (ember.prod.js, line 3078)
– Nate F.