Skip to content

Instantly share code, notes, and snippets.

@hvgotcodes
Last active November 2, 2021 06:15
Show Gist options
  • Save hvgotcodes/fbaaa11ae12052055a1c35bd81fcdfc3 to your computer and use it in GitHub Desktop.
Save hvgotcodes/fbaaa11ae12052055a1c35bd81fcdfc3 to your computer and use it in GitHub Desktop.
form-for-changesets
import Ember from 'ember';
import {
validatePresence,
validateFormat,
} from 'ember-changeset-validations/validators';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
validation: {
email: [
validateFormat({type: 'email'}),
],
},
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{#form-for (changeset (hash email="hi") validation) as |f|}}
{{f.text-field "email"}}
{{f.submit "Go"}}
{{/form-for}}
<br>
<br>
{
"version": "0.10.5",
"EmberENV": {
"FEATURES": {}
},
"ember-form-for": {
"errorsProperty": "error"
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.6.2",
"ember-data": "2.8.0",
"ember-template-compiler": "2.6.2",
"ember-testing": "2.6.2"
},
"addons": {
"ember-form-for": "2.0.0-alpha.9",
"ember-changeset": "1.1.2",
"ember-changeset-validations": "1.1.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment