This repository has been archived by the owner on Apr 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
No error messages? #5
Labels
Comments
Will work on this and have it in the next version 👍 |
Thanks - when will You menage to do it? |
Perhaps this example would be helpful. |
Hello, Thx for the link, it was very helpfull. The configuration object for a field look like this {
...
templateOptions: {
...
validate: true, //display or not the error message section
validateCustom: 'your url' //the url of a template with ngMessage
required: true,
maxlength: 14,
minlength: 5,
... ,
validation : { //default error message, they are replaced by those on the template if defined
messages: {
required: (viewValue, modelValue, scope)=> {
return scope.to.label + ' is required';
},
minlength: (viewValue, modelValue, scope)=> {
return scope.to.minlength + ' character minimum';
},
...
}
}
}
} the template with ng-message directive must look like this : <script id="validation-errors.html" type="text/ng-template">
<div class="error" ng-message="email">
<i class="ion-information-circled"></i> Invalid email.
</div>
<div class="error" ng-message="required">
<i class="ion-information-circled"></i> Please fill out this field.
</div>
<div class="error" ng-message="minlength">
<i class="ion-information-circled"></i> Damn too short :(.
</div>
<div class="error" ng-message="maxlength">
<i class="ion-information-circled"></i> Maximum number of characters reached relax.
</div>
</script> The div containing the messages is decorated with is-dirty, id-touched, and is-invalid class depending on the field state. here is a simple codepen demo with some extra style |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I see that here are no feedback messages :/ I suppose it's because ionic has none.
How to fiz it? How to add those messages? Can You give simpliest example for required text input?
The text was updated successfully, but these errors were encountered: