Using JSON rather than API


#1

Quite new to ember, so pardon if the topic has been addressed.

I’ve followed the Tom Dale’s guide sample project. Getting the project to work with fixture data is working as intended. I am now trying to have the data in JSON. What I am encountering is a:

“Error while loading route: undefined”

The difference I have from the sample project is rather than the Tom Dale’s API, I am pointing to a JSON. JSON is the post fixture data in the example.

my update to route: App.PostsRoute = Ember.Route.extend({ model: function() { return .getJSON('js/json/posts.json?callback=?').then(function(data){ return data.posts.map(function(post){ post.body = post.content; return post; }); }); } }); App.PostRoute = Ember.Route.extend({ model: function(params) { return .getJSON(‘js/json/posts.json?id=’+params.post_id+’&callback=?’).then(function(data){ return data.posts.map(function(post){ data.post.body = data.post.content; return data.post; }); }); } });

sample project route: App.PostsRoute = Ember.Route.extend({ model: function() { return .getJSON('http://tomdale.net/api/get_recent_posts/?callback=?').then(function(data){ return data.posts.map(function(post){ post.body = post.content; return post; }); }); } }); App.PostRoute = Ember.Route.extend({ model: function(params) { return .getJSON('http://tomdale.net/api/get_posts/?id=’+params.post_id+’&callback=?’).then(function(data){ return data.posts.map(function(post){ data.post.body = data.post.content; return data.post; }); }); } });

Where am I have I gotten off track? How do I get the route to be recognized and get the post rendering?

Thanks in advance, Ed