The gv-error-message
elements are used to display error messages associated with specific form controls. They should be placed inside a div
or any other container element alongside the corresponding input elements.
<gv-error-message>
Description:
The <gv-error-message>
element displays the error message associated with a specific form control. The name of the form control is provided as an attribute value to pair the error message with the correct form control.
Attributes:
name
(string): The name of the form control for which the error message is to be displayed.Usage:
htmlCopy code
<div>
<input type="text" formControlName="firstName">
<gv-error-message name="firstName"></gv-error-message>
</div>
The GV
directive can also be used with nested FormArray
elements. In this case, the GV
directive should be applied to the parent div
containing the nested FormArray
, and the GVModel
associated with the nested form controls should be specified as a model that extends from GVModel
.
<div formArrayName="companies">
Description:
The div
element with the attribute formArrayName="companies"
represents the parent container for a nested FormArray
named "companies." The GV
directive is applied to this element, indicating that the validation rules for the nested form controls are defined by the GVUserModel1
, which should be a model extending from GVModel
.
Usage: