Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save stephanebruckert/b16c0637affadf263b7f766b0541dffa to your computer and use it in GitHub Desktop.
Save stephanebruckert/b16c0637affadf263b7f766b0541dffa to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
import { buildValidations, validator } from 'ember-cp-validations';
const Validations = buildValidations({
email: {
type: 'email',
validators: [
validator('format'),
validator('uniqueness')
]
}
});
export default Ember.Controller.extend(Validations, {
appName: 'Ember Twiddle'
});
{{input value=(mut email) placeholder="Enter an email"}}
{{validations.attrs.email.message}}
{
"version": "0.10.7",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.10.0",
"ember-data": "2.10.0",
"ember-template-compiler": "2.10.0",
"ember-testing": "2.10.0"
},
"addons": {
"ember-cp-validations": "3.1.5"
}
}
import BaseValidator from 'ember-cp-validations/validators/base';
export default BaseValidator.extend({
validate(value, options) {
console.log(value + ' should have been an email?');
return ' and open the console';
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment