Closed revati closed 8 years ago
Thank you for your feedback.
Are there any reasonable ways how to pass validator to child component?
I recommend that you should wrap the validator
element directive (<validator>
) to your component (<child-component>
) that has validatable element (e.g, input
, checkbox
), because validator
element directive will check validatable elements of internal, and dynamically set the validation result to validator scope (prefixed with $
).
Close (in-activity)
If i have component with
And
child-component
withvue validator is complaining
Uncaught TypeError: Cannot read property 'validate' of undefined
. It relays onthis.vm.$options._validator
but in child component it is undefined (becausethis
is not the same)Are there any reasonable ways how to pass validator to child component? Why
<validator name="myValidator">
is required at all? Are there any drawbacks if each field is wrapped within new instance of<validator name="myValidator">
?