How do you create a computed property that matches a regular expression? Here is how I used to do it:
1 2 3 |
isValidEmail: Ember.computed('model.email',function(){ return this.get('model.email').match(/^.+@.+\..+$/); }) |
But I found a more readable way to do it using the match computed property:
1 |
isValidEmail: Ember.computed.match('email', /^.+@.+\..+$/) |
Also published on Medium.