Skip to content

Instantly share code, notes, and snippets.

@chrism
Last active August 29, 2015 14:09
Show Gist options
  • Save chrism/5f74d37cf344d127745d to your computer and use it in GitHub Desktop.
Save chrism/5f74d37cf344d127745d to your computer and use it in GitHub Desktop.
import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
createTodo: function (todoDetails) {
var todoRecord = this.store.createRecord('todo', todoDetails);
var controller = this;
var model = this.get('model');
var todos = model.get('todos').then(function (todos) {
todos.pushObject(todoRecord);
model.save();
});
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment