samedi 1 août 2015

Load model asynchronously with a non-crud action

I have an Ember 1.13 application and I want to list all users that match with another user. I have http://localhost:3000/api/v1/users/1/matches that returns

 {"users":[{"id":1,"email":"test@test.com","nickname":"Test","bio":"test","created_at":"2015-06-28T16:03:52.423Z","updated_at":"2015-06-28T16:03:52.423Z","encrypted_password":"$2a$10$RPJmVJNfFvjwzIG0wfC6yONRz20WBogUw35ibz2Hv.M6TC/M7FZ8e","confirmation_token":null,"remember_token":"fb5653e22ad30d3ad3a90ab0b028bd7348cd71a1"}]}

As shown in the doc, I have this route :

export default Ember.Route.extend
  model: ->
    Ember.$.getJSON('http://localhost:3000/api/v1/users/1/matches')

And this template :

{{#each model as |user|}}
  user
{{/each}}

I should see user in my template but I have nothing. Did I miss something?




Aucun commentaire:

Enregistrer un commentaire