Hi i want to set up validation if e-mail exist in db for my Ember JS aplication. The thing is that i can't call to my store right from formValidators.
formValidators: {
email: [
{
message: 'Please provide email in a valid format',
validate: (inputValue) => {
let emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
return emailPattern.test(inputValue);
}
},
{
message: 'Email already exist',
validate: (inputValue, self) => {
return this.get('store').queryRecord('email',
{
filter: {
email: inputValue
}
}).then(function () { return false })
}
}
]
}
When running in chrome console i get this error:
TypeError: _this2.get is not a function(…)
I wonder that is quite easy problem, but i spent few hours and have no idea how to solve this.
Aucun commentaire:
Enregistrer un commentaire