-
-
Save thomassnielsen/aa99002227469d3ad4606d6e09779d37 to your computer and use it in GitHub Desktop.
ember-validated-form basic example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import UserValidations from 'twiddle/validations/user'; | |
export default Ember.Controller.extend({ | |
UserValidations, | |
actions: { | |
submit(model) { | |
console.log('submit', model) | |
model.save() | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
model() { | |
return Ember.RSVP.hash({ | |
user: Ember.Object.create({}) | |
}); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.12.1", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember-template-compiler": "release", | |
"ember-testing": "release", | |
"ember": "release" | |
}, | |
"addons": { | |
"ember-data": "3.0.2", | |
"ember-validated-form": "1.3.1" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
validateInclusion | |
} from 'ember-changeset-validations/validators'; | |
export default { | |
terms: [ | |
validateInclusion({ | |
list: [true], | |
message: "Please accept the terms and conditions!" | |
}) | |
] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment