1
votes

I am having a big trouble training to use ember.js. When I add the following code in http://emberjs.com/guides/getting-started/adding-a-route-and-template/ all my contents disappeared.

Firebug detect: "ReferenceError: Todos is not defined", but was defined in todo.js e loaded properly in index.html:

todo.js

Todos.Todo = DS.Model.extend({
  title: DS.attr('string'),
  isCompleted: DS.attr('boolean')
});

Todos.Todo.FIXTURES = [
 {
   id: 1,
   title: 'Learn Ember.js',
   isCompleted: true
 },
 {
   id: 2,
   title: '...',
   isCompleted: false
 },
 {
   id: 3,
   title: 'Profit!',
   isCompleted: false
 }
];

This is a link to all my files: https://gist.github.com/anonymous/6416743 (not included the base js files).

I do everything in the tutorial until http://emberjs.com/guides/getting-started/displaying-model-data/

Thanks for any help.

1

1 Answers

5
votes

You are missing the creation of your Application instance. This must be the first Ember statement in your javascript. Put it after the library reference and before your own code. This creates the namespace Todos and afterwards afterwards you can put objects like Todos.Todo into that namespace.

var Todos = Ember.Application.create({});