As a way of learning AngularJS, I designed a very basic app that consumes data from a JSON API and simply throws it to the screen (the code is on Github.) Now I'm learning Ember.js and I simply can't get how to achieve the same result. Using as little code as possible, what would be a simple way of consuming data from a public JSON API (e.g. https://graph.facebook.com/?id=http://stackoverflow.com) and routing it to the view?
-
Why the down vote? I'd be grateful if someone could point me a better way to describe my question, instead of just down voting. A comment is always helpful in situations like this.João– João2014-01-12 14:00:42 +00:00Commented Jan 12, 2014 at 14:00
Add a comment
|
1 Answer
You probably should take a quick run through the guides: http://emberjs.com/guides/
http://emberjs.jsbin.com/ajocUPa/1/edit
App.IndexRoute = Ember.Route.extend({
model: function() {
return $.getJSON('https://graph.facebook.com/?id=http://stackoverflow.com');
}
});
or even less code
2 Comments
João
I did go through the documentation, but unfortunately didn't understand the usage of RESTAdapter. Thanks, your answer is pretty straightforward and self explanatory.
João
By the way, it turns out the problem is with the host I'm using. Do you have any idea why it's not working? emberjs.jsbin.com/obaTUGaG/1/edit