Last active
December 13, 2016 21:29
-
-
Save carusog/b30473561a34d5b349a3440ae83b7904 to your computer and use it in GitHub Desktop.
Validating form fields
This file contains hidden or 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.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
This file contains hidden or 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.Controller.extend({ | |
isValidEmail: Ember.computed.match('emailAddress', /^.+@.+\..+$/), | |
isDisabled: Ember.computed.not('isValidEmail'), | |
// MY FAILING ATTEMPT TO GET MESSAGE LENGTH | |
// messageLength: Ember.computed('message', function () { | |
// return this.get('message').length; | |
// }), | |
// isValidMessage: Ember.computed.gte(this.messageLength, 5), | |
//isDisabled: Ember.computed.and('isValidEmail', 'isValidMessage'), | |
actions: { | |
saveInvitation() { | |
alert(`Saving of the following email address is in progress: ${this.get('emailAddress')}`); | |
this.set('responseMessage', `Thank you! We've just saved your email address: ${this.get('emailAddress')}`); | |
this.set('emailAddress', ''); | |
setTimeout(() => { this.set('responseMessage', ''); }, 3000); | |
} | |
} | |
}); |
This file contains hidden or 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
body { | |
margin: 12px 16px; | |
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
font-size: 12pt; | |
} |
This file contains hidden or 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.10.6", | |
"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.9.0", | |
"ember-data": "2.9.0", | |
"ember-template-compiler": "2.9.0", | |
"ember-testing": "2.9.0" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment