#62 Ember Changeset Validations

In the last tip, i talked about the awesome addon ember-changeset, there is a companion addon to add validations to your changeset.
 Install the addon with

ember install ember-changeset-validations

Then you can wire up your model validator

changeset=(changeset user EmployeeValidations)
submit=(action "submit")
rollback=(action "rollback")

Then create your validator

// validations/employee.js
import {
} from 'ember-changeset-validations/validators';

export default {
firstName: [
validateLength({ min: 4 })
lastName: validatePresence(true),
email: validateFormat({ type: 'email' }),
password: validateLength({ min: 8 }),
passwordConfirmation: validateConfirmation({ on: 'password' })

Try it out and let me know how it works. Do you have a better way to handle validations?
 ember-changeset-validations at https://github.com/DockYard/ember-changeset-validations
 Ember Changeset Tip 61

Originally published at Ember Daily Tips.