Getting started

Decorators

Components

Description

The GV directive is a custom Angular directive that pairs error messages with form controls. It is used to display validation error messages for form controls defined within an Angular FormGroup based on the validation rules specified in a model that extends from GVModel. The directive is applied as an attribute to HTML elements representing form controls.

Directive Input

[GV] (Model: GVModel)

Description: The [GV] directive is used to associate a model that extends from GVModel with the form controls within an Angular FormGroup. The model provides the validation rules for the form controls, such as maximum length, minimum length, and required fields.

Input Type: Model - A class that extends from GVModel.

Usage:

htmlCopy code
<form [GV]="GVUserModel" [formGroup]="form">
  <!-- Form controls and error messages -->
</form>

Error Message Elements

The gv-error-message elements are used to display error messages associated with specific form controls.

<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:

Usage:

htmlCopy code
<div>
  <input type="text" formControlName="firstName">
  <gv-error-message name="firstName"></gv-error-message>
</div>

Nested FormArray and GVModel