Customise\Override Error Messages
The @releasium/ngx-grand-validator
library provides a mechanism to override the default error messages used by the @GV
decorator when validating form controls. The error messages are stored in the GV_DEFAULT_ERROR_MESSAGES
object, and you can customize specific error messages by creating a new object with the desired overrides.
GV_DEFAULT_ERROR_MESSAGES
(Object)Description:
The GV_DEFAULT_ERROR_MESSAGES
constant is an object that contains the default error messages used by the @GV
decorator when performing form control validation. Each error message is associated with a specific validation rule name.
Example:
typescriptCopy code
{
'required': 'This field is required',
'minLength': 'Minimum length should be {0}',
'email': 'Invalid email address',
// ... other default error messages ...
}
overidenMsgs
(Object)Description:
The overidenMsgs
object is used to override specific error messages from the GV_DEFAULT_ERROR_MESSAGES
object. By creating a new object and providing updated messages for specific validation rules, you can customize the error messages to better suit your application's needs.