dimanche 27 novembre 2016

displaying users avatars list with Ember.js and handlebars

I'm just starting using Ember js and I'm stuck on a very simple thing. I want to display avatars from a users list based on fake API. I manage to get an image when using the absolute path, but nothing when I replace the src with the variable

the var I need to use from my users.json: avatarUrl

here is my users/index.hbs




<img src="absolute-path" alt="avatar">



and my users/index.js

import Ember from 'ember';
export default Ember.Route.extend({
model() {
return Ember.$.ajax('api/v1/users.json');
}
});

This works and displays one avatar. But when I want to use my variable to diplays my avatar list,

<img  alt="avatar">

then it does not work anymore, I got a build error message.

What am I missing? Sorry in advance, it must be something really obvious...

Thanks!




Aucun commentaire:

Enregistrer un commentaire