I'm using Ember's Getting Started Guide to create a TodoMVC. Even though I've strictly followed the instructions I'm stuck at creating a new model instance.
When I enter a new todo and hit enter I get the following console output:
Uncaught Error: Nothing handled the action 'createTodo'. If you did handle the action, this error can be caused by returning true from an action handler in a controller, causing the action to bubble. ember.min.js:18
My js/controllers/todos_controller.js
looks like this:
Todos.TodosController = Ember.ArrayController.extend({
actions: {
createTodo: function() {
// Get the todo title set by the "New Todo" text field
var title = this.get('newTitle');
if (!title.trim()) { return; }
// Create the new Todo model
var todo = this.store.createRecord('todo', {
title: title,
isCompleted: false
});
// Clear the "New Todo" text field
this.set('newTitle', '');
// Save the new model
todo.save();
}
}
});
Any ideas?
UPDATE
Putting my code in JSFiddle does work: http://jsfiddle.net/narzero/7926x/5/. I don't understand why.
I'm working on a Mac OSX 10.9.1.
If someone is still looking for the answer. I encountered the same problem as the one described above.
I have the ember application installed by yeoman. It provides an app.js file:
var TodomvcEmber = window.TodomvcEmber = Ember.Application.create();
/* Order and include as you please. */
require('scripts/controllers/*');
require('scripts/store');
require('scripts/models/*');
require('scripts/routes/*');
require('scripts/views/*');
require('scripts/router');
noticed that in my .tmp/scripts/combined-scripts.js file the added controllers I had put in /scripts/controllers/todos_controller.js, wheren't integrated. In the app.js file, I changed the order of the require ( put the require of the controller a bit downwards )
var TodomvcEmber = window.TodomvcEmber = Ember.Application.create();
/* Order and include as you please. */
require('scripts/store');
require('scripts/models/*');
require('scripts/controllers/*');
require('scripts/routes/*');
require('scripts/views/*');
require('scripts/router');
And that did the trick for me.