Last active
August 22, 2023 04:29
-
-
Save czosel/95b040c96b7dc60dc4d0bb2dc5f5de26 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, | |
validateInclusion | |
} from 'ember-changeset-validations/validators'; | |
export default { | |
firstName: [validatePresence(true), validateLength({ min: 3, max: 40 })], | |
lastName: [validatePresence(true), validateLength({ min: 3, max: 40 })] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment