We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ViewModel validation seems to be usable only from the template by using VM bindings, like so:
Template.comp.viewmodel({ field: ViewModel.property.string.notBlank });
<span {{b "if: field.invalid"}}>your field has errors</span>
But this doesn't work:
Template.comp.viewmodel({ field: ViewModel.property.string.notBlank hasErrors() { return this.field.invalid(); } });
{{#if hasErrors}}<span>your field has errors</span>
This makes it really hard to use ViewModel validation in components, for example, if I have a TextBox component that accepts hasErrors as a prop.
TextBox
hasErrors
Reproduction: https://github.com/arggh/viewmodel-validation-issue
The text was updated successfully, but these errors were encountered:
This seems to be an issue with the else if not VM, it works if you do something like:
else if
{{#if isValidating}} <div>Validating</div> {{/if}} {{#if nameIsValid}} <div>Name is valid</div> {{/if}} {{#if nameIsInvalid}} <div>Name is not valid, minimum 5 chars</div> {{/if}}
If VM wasn't "reporting" the changes to Tracker the if's wouldn't update as necessary.
Sorry, something went wrong.
No branches or pull requests
ViewModel validation seems to be usable only from the template by using VM bindings, like so:
But this doesn't work:
This makes it really hard to use ViewModel validation in components, for example, if I have a
TextBox
component that acceptshasErrors
as a prop.Reproduction: https://github.com/arggh/viewmodel-validation-issue
The text was updated successfully, but these errors were encountered: