-
-
Save GCheung55/38c9739a32bf15aea1b5beaf73295f8b to your computer and use it in GitHub Desktop.
ember-validated-form
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: { | |
firstName: 'Test', | |
} | |
}); | |
} | |
}); |
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.15.0", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js", | |
"ember": "3.2.2", | |
"ember-template-compiler": "3.2.2", | |
"ember-testing": "3.2.2" | |
}, | |
"addons": { | |
"ember-data": "3.2.0", | |
"ember-validated-form": "1.4.0" | |
} | |
} |
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 { | |
validatePresence, | |
validateLength, | |
validateNumber, | |
} from 'ember-changeset-validations/validators'; | |
export default { | |
firstName: [validatePresence(true), validateLength({ min: 3, max: 40 })], | |
lastName: [validatePresence(true), validateLength({ min: 3, max: 40 })], | |
age: [validatePresence(true), validateNumber({gte:21})] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment