0

I am trying to define a model in ember from a json object that does not conform to the JSON API standard. If I define my Route like

export default Ember.Route.extend({
    model: function(){
        var url  = "http://website.com/prequalification";

        return Ember.$.getJSON(url).then(function(data) {
            return data.collection.template;
        });
    }
});

How do I then access my data in the template. I am trying to avoid writing a custom adapter to handle the JSON. Am heading down the wrong path here?

Thanks

1 Answer 1

1

When you navigate to the route which is using this route (you may need to familiarize yourself with the router and routes to understand that statement, http://emberjs.com/guides/routing/defining-your-routes/) the json returned by that model hook will be available in the template using standard handlebars syntax {{property}}

Here's a simple example, note the naming convention (index template, Index route): http://emberjs.jsbin.com/

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.