This is using ember-cli 0.2.3
(model) todo.js
import DS from 'ember-data';
export default DS.Model.extend({
title: DS.attr('string'),
isCompleted: DS.attr('boolean')
}).reopenClass({
FIXTURES: [
{
id: 1,
title: "Complete Ember.js Tutorial",
isCompleted: false
},
{
id: 2,
title: "Checkout some more ember stuff",
isCompleted: true
},
{
id: 3,
title: "Solve world hunger (with Ember)",
isCompleted: false
}
]
});
in router.js
this.resource('todos', { path: '/' });
in todos.js
export default Ember.Route.extend({
model: function() {
return this.store.find('todo');
}
});
in todos.hbs
{{#each}}
//some code here using the model
{{/each}}
in developer console got this notice:
DEPRECATION: Using the context switching form of {{each}} is deprecated.
Please use the keyword form (`{{#each foo in bar}}`) instead
Please advice on the actual each code for removing the deprecation notice.
The following are codes that I tried:
1 - {{#each todo in todo}} //no error, but no data in todo list
2 - {{#each todo in controller.todo}} //no error, but no data in todo list
3 - {{#each todo in todos.todo}} //no error, but no data in todo list
4 - {{#each todo in todos}} //no error, but no data in todo list
THANK YOU - for any help, cheers!
Aucun commentaire:
Enregistrer un commentaire