mardi 19 janvier 2016

Ember Why can't the model data be rendered into template?

So I've been beating my head against this for a few days now. I can't get my model data to render in the template at all. No errors are being thrown. Looking in the Ember Inspector, the Data tab shows my record loaded in tasks. Any help much appreciated.

// app/adapters/application.js
import Ember from 'ember';
import FirebaseAdapter from 'emberfire/adapters/firebase';

const { inject } = Ember;

export default FirebaseAdapter.extend({
    firebase: inject.service(),
});

// app/routes/tasks.js
import Ember from 'ember';

export default Ember.Route.extend({
    model: function(){
        return this.store.findAll('task');
    },
});

// app/model/task.js
import DS from 'ember-data';

export default DS.Model.extend({
    title: DS.attr('string'),
    description:DS.attr('string'),
    date: DS.attr('date'),
    created: DS.attr('string',{
        defaultValue:function(){
            return new Date();
        }
    })
});

// app/templates/tasks.hbs
<h2>tasks</h2>

{{#each task in model}}
    <h2>{{task.title}}</h2>
{{/each}}

Ember Inspector:
View Tree:
tasks    emtasks/templates/tasks   <DS.RecordArray..>  tasks  --

Data:
task(11)




Aucun commentaire:

Enregistrer un commentaire