Skip to content

Instantly share code, notes, and snippets.

@abachuk
Created February 7, 2017 20:18
Show Gist options
  • Save abachuk/56ffc88dbf654d25110b059091c0395a to your computer and use it in GitHub Desktop.
Save abachuk/56ffc88dbf654d25110b059091c0395a to your computer and use it in GitHub Desktop.
actions: {
sendContactForm() {
// Getting input values.
// TODO: add validation before trying to save the values.
const submittedForm = {
name: this.get('name'),
email: this.get('email'),
company: this.get('company'),
phone: this.get('phone'),
message: this.get('message'),
timestamp: new Date().getTime()
+ };
// Save the submitted form to our database
+ const newContact = this.store.createRecord('contact', submittedForm);
+ newContact.save().then(function(res) {
// display success or fail message to the user after saving the values to DB
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment