# new NgxCrudFormField()
Abstract class representing a CRUD form field for Angular applications
This class provides the base implementation for CRUD form fields in Angular, implementing both CrudFormField and ControlValueAccessor interfaces.
- Implements:
- FieldProperties
- ControlValueAccessor
Members
# component
Reference to the component's element
ElementRef representing the component's native element
ElementRef
# component
Reference to the component's element
ElementRef representing the component's native element
# onChange
Change callback function
Function called when the field value changes
Properties:
Name | Type | Description |
---|---|---|
onChange |
function
|
onChange event handler |
function
# onChange
Change callback function
Function called when the field value changes
Properties:
Name | Type | Description |
---|---|---|
onChange |
function
|
onChange event handler |
# onTouch
Touch callback function
Function called when the field is touched
Properties:
Name | Type | Description |
---|---|---|
onTouch |
function
|
onTouch event handler |
function
# onTouch
Touch callback function
Function called when the field is touched
Properties:
Name | Type | Description |
---|---|---|
onTouch |
function
|
onTouch event handler |
CrudOperations
# operation
Current CRUD operation
Represents the current CRUD operation being performed
HTMLElement
# protected parent
Parent HTML element
Reference to the parent HTML element of the field
# sf
String formatting function
Provides access to the sf function for error message formatting
Properties:
Name | Type | Description |
---|---|---|
sf |
function
|
String formatting function |
# sf
String formatting function
Provides access to the sf function for error message formatting
Properties:
Name | Type | Description |
---|---|---|
sf |
function
|
String formatting function |
Methods
# afterViewInit() → {HTMLElement}
After view initialization logic
Performs necessary setup after the view has been initialized
The parent element of the field
HTMLElement
# getErrors(parent) → {string|void}
Get field errors
Retrieves all errors associated with the field
Parameters:
Name | Type | Description |
---|---|---|
parent |
HTMLElement
|
An array of error objects
string
|
void
# onDestroy() → {void}
Cleanup on component destruction
Unregisters the field when the component is destroyed
void
# registerOnChange(fn) → {void}
Register change callback
Registers a function to be called when the field value changes
Parameters:
Name | Type | Description |
---|---|---|
fn |
function
|
The function to be called on change |
void
# registerOnTouched(fn) → {void}
Register touch callback
Registers a function to be called when the field is touched
Parameters:
Name | Type | Description |
---|---|---|
fn |
function
|
The function to be called on touch |
void
# setDisabledState(isDisabled) → {void}
Set disabled state
Sets the disabled state of the field
Parameters:
Name | Type | Description |
---|---|---|
isDisabled |
boolean
|
Whether the field should be disabled |
void
# writeValue(obj) → {void}
Write value to the field
Sets the value of the field
Parameters:
Name | Type | Description |
---|---|---|
obj |
string
|
The value to be set |
void