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
*[Changing when validation messages are displayed](#changing-when-validation-messages-are-displayed)
11
+
*[Declaring your own validator functions](#declaring-your-own-validator-functions)
12
+
*[Edge use cases](#edge-use-cases)
13
+
*[Handling custom HTML validation messages](#handling-custom-html-validation-messages)
14
+
*[Using arv-validation-messages when not using `[formGroup]` or `formGroupName` attributes](#using-arv-validation-messages-when-not-using-[formGroup]-or-formGroupName-attributes)
15
+
5
16
## Installation
6
17
7
18
To install this library, run:
@@ -131,6 +142,46 @@ export class AppModule { }
131
142
132
143
Note that `formSubmitted` can be undefined when it's not known if the form is submitted, due to the form tag missing a formGroup attribute.
133
144
145
+
## Declaring your own validator functions
146
+
147
+
Angular provides a limited set of validator functions. To declare your own validator functions _and_ combine it with this library use the `ValidatorDeclaration` class. It supports declaring validators with zero, one or two arguments.
148
+
149
+
**Note** that if your validator doesn't return an object as the inner error result, but e.g. a `boolean` such as in the examples below, then this will be replaced by an object that can hold the validation message. Thus in the first example below `{ 'hasvalue': true }` becomes `{ 'hasvalue': { 'message': 'validation message' } }`.
0 commit comments