match (dependentKey, regexp) Ember.ComputedProperty
public
A computed property which matches the original value for the dependent property against a given RegExp, returning true
if the value matches the RegExp and false
if it does not.
Example
let User = Ember.Object.extend({ hasValidEmail: Ember.computed.match('email', /^.+@.+\..+$/) }); let user = User.create({loggedIn: false}); user.get('hasValidEmail'); // false user.set('email', ''); user.get('hasValidEmail'); // false user.set('email', 'ember_hamster@example.com'); user.get('hasValidEmail'); // true
Parameters:
-
dependentKey
String
-
regexp
RegExp
Returns:
-
Ember.ComputedProperty
- computed property which match the original value for property against a given RegExp
Please login to continue.