This Ember addon manages form submission in the controller/component and route layers of Ember apps.
It works alongside most form component addons including but not limited to Ember EasyForm and Ember Paper.
Ember EasyForm is not longer a required dependency for this addon.
npm uninstall --save-dev ember-validations
ember install ember-easy-form-extensions
Designed to handle formsubmission events, ember-easy-form-extensions reduces boilerplate code and standardizes form submission whilst providing a broad API for you to interact with.
// app-name/controllers/users/new.js
import Ember from 'ember';
import FormMixin from 'ember-easy-form-extensions/mixins/components/form';
export default Ember.Controller.extend(
FormMixin, {
validations: {
'model.title': {
presence: true
}
}
/* Runs if cancel button in {{form-submission}} is clicked */
cancel: function() {
this.transitionTo('posts');
},
/* Runs after validations pass and submit button in {{form-submission}} is clicked */
save: function() {
this.get('content').save().then(function(post) {
this.transitionTo('post', post);
});
},
});
A walkthrough and documentation can be found in the wiki.