Skip to content

Instantly share code, notes, and snippets.

@geekygrappler
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geekygrappler/89ef319a584bdb28d7bc to your computer and use it in GitHub Desktop.
Save geekygrappler/89ef319a584bdb28d7bc to your computer and use it in GitHub Desktop.
import Ember from 'ember';
export default Ember.Route.extend({
model: function() {
return this.store.find('todo');
},
actions: {
createTodo: function (newTitle) {
// Create the new Todo model
var todo = this.store.createRecord('todo', {
title: newTitle,
isCompleted: false
});
// Clear the "New Todo" text field
// DELETE THESE LINES!!!
// this.controllerFor('todos').set('newTitle', '');
// Save the new model
todo.save();
},
// Other Actions
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment