2

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?

1
  • 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. Commented Jan 12, 2014 at 14:00

1 Answer 1

3

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

http://emberjs.jsbin.com/ajocUPa/2/edit

Sign up to request clarification or add additional context in comments.

2 Comments

I did go through the documentation, but unfortunately didn't understand the usage of RESTAdapter. Thanks, your answer is pretty straightforward and self explanatory.
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.