You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 24, 2018. It is now read-only.
When I enter "a" into the field, then valdrMessage doesn't display anything even though the form is invalid. This is because type="number" trigger angular's number validator and valdr's min-validator is not even called. This is confusing if you want to use only valdrMessage for displaying validation errors.
Therefore it would be handy if valdrMessage knew about angular's builtin validations.
Problem:
valdrMessage relies on message keys from the constraints-JSON for displaying errror messages. Since there are none for angular's builtin validation, what should it display?
What do you recommend?
The text was updated successfully, but these errors were encountered:
It should be pretty straightforward to also show other validation errors than those from valdr validators in the message template. We can read all violations from the ngModelController in the valdrMessage directive and provide them to the message templates.
What's missing now are the error messages. I'd suggest that we extend the valdrMessage service with a new function where the user can register error messages by validator name.
valdrMessage.addMessage('required','This field is required.');
The validator name could be number, minlength, required or any other name of built-in or custom AngularJS validators.
Message inheritance could be done similar to how ngMessages does it: The default message is the one registered for the validator name. If you need a more specific message on field level, you can register it using valdrs type and field name:
valdrMessage.addMessage('Person.firstName.required','The first name is required.');
I have a form field
with validation rules
and I use valdrMessage for displaying errors.
When I enter "a" into the field, then valdrMessage doesn't display anything even though the form is invalid. This is because
type="number"
trigger angular'snumber
validator and valdr'smin-validator
is not even called. This is confusing if you want to use only valdrMessage for displaying validation errors.Therefore it would be handy if valdrMessage knew about angular's builtin validations.
Problem:
valdrMessage relies on message keys from the constraints-JSON for displaying errror messages. Since there are none for angular's builtin validation, what should it display?
What do you recommend?
The text was updated successfully, but these errors were encountered: