Skip to content

Instantly share code, notes, and snippets.

@Blackmist
Last active December 17, 2015 04:18
Show Gist options
  • Save Blackmist/5548924 to your computer and use it in GitHub Desktop.
Save Blackmist/5548924 to your computer and use it in GitHub Desktop.
newpost action controller
App.NewpostController = Ember.ObjectController.extend({
title: '',
author: '',
body: '',
save: function() {
//create the post
console.log('title: '+this.get('title'));
//set fields back to empty so the form is cleared
//on next visit
this.set('title','');
this.set('author','');
this.set('body','');
//transition back to posts
this.transitionToRoute('posts');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment