I'm using Vee validate for from validation, validation rules are coming from backend and passed to component data in following format:
"rules": {
"password": "{ required: true, regex: /(?=.*\\d)(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}/ }",
"old_password": "required"
}
How can i use rule from data in v-validate directive?
<input name="password" ref="password" v-model="password" v-validate="rules.password">
this syntax give me an error No such validator ''{ required' exists.
Looks like vue is parsing the v-validate value somehow
p.s. for validation rules which are simple strings it works ok
<input name="old_password" v-model="old_password" v-validate="rules.old_password">
v-validate="rules.password.required"
? – Boussadjra Brahim{ required: true, regex: /(?=.*\\d)(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}/ }
as validation rule – MaximJSON.parse()
? – ssbpassword
is a String instead of an Object – Giovanerules.password
are not really inserted in html, but processed as js variable – Maxim