Last active
August 29, 2015 14:21
-
-
Save geekygrappler/1e8743ea5bcd575742fb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
model: function() { | |
return this.store.find('todo'); | |
}, | |
actions: { | |
// Additional lines truncated for brevity... | |
acceptChanges: function(todo) { | |
if (Ember.isEmpty(todo.get('title'))) { | |
this.send('deleteTodo', todo); | |
} else { | |
todo.save(); | |
} | |
}, | |
deleteTodo: function(todo) { | |
todo.deleteRecord(); | |
} | |
} | |
}); |
Hi, in Edit and Delete Todos
section todoRoute is not generated with cli. It is later, in Child Routes.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Would it be better to handle the delete in the todo-item component? For example:
...and remove
acceptChanges
entirely from the route.Also it looks like the input helper is saving any changes so
todo.save();
might not be required?