File

src/app/core/entity/entity-field-edit/dynamic-edit/dynamic-edit.component.ts

Extends

CustomFormControlDirective

Implements

EditComponent

Metadata

Index

Properties
Methods
Inputs
Outputs

Inputs

entity
Type : Entity
formFieldConfig
Type : FormFieldConfig
aria-describedby
Type : string
disabled
Type : boolean
ngControl
Type : any
Default value : inject(NgControl, { optional: true, self: true })
placeholder
Type : string
required
Type : boolean
value
Type : T

Outputs

valueChange
Type : EventEmitter

Methods

blur
blur()
Returns : void
focus
focus()
Returns : void
onContainerClick
onContainerClick(event: MouseEvent)
Parameters :
Name Type Optional
event MouseEvent No
Returns : void
registerOnChange
registerOnChange(fn: any)
Parameters :
Name Type Optional
fn any No
Returns : void
registerOnTouched
registerOnTouched(fn: any)
Parameters :
Name Type Optional
fn any No
Returns : void
setDescribedByIds
setDescribedByIds(ids: string[])
Parameters :
Name Type Optional
ids string[] No
Returns : void
setDisabledState
setDisabledState(isDisabled: boolean)
Parameters :
Name Type Optional
isDisabled boolean No
Returns : void
writeValue
writeValue(value: T, notifyFormControl)

Implementation for Angular ControlValueAccessor interface that links the form control value to the component value

Parameters :
Name Type Optional Default value Description
value T No

The new value to set

notifyFormControl No false

Whether to notify the FormControl of this change (for internal updates)

Returns : void

Properties

_disabled
Default value : false
_value
Type : T
controlType
Type : string
Default value : "custom-control"
elementRef
Default value : inject<ElementRef<HTMLElement>>(ElementRef)
errorState
Default value : false
errorStateMatcher
Default value : inject(ErrorStateMatcher)
focused
Default value : false
id
Default value : `custom-form-control-${CustomFormControlDirective.nextId++}`
Static nextId
Type : number
Default value : 0
onChange
Default value : () => {...}
onTouched
Default value : () => {...}
parentForm
Default value : inject(NgForm, { optional: true })
parentFormGroup
Default value : inject(FormGroupDirective, { optional: true })
stateChanges
Default value : new Subject<void>()
touched
Default value : false
import { FormFieldConfig } from "#src/app/core/common-components/entity-form/FormConfig";
import { DynamicComponentDirective } from "#src/app/core/config/dynamic-components/dynamic-component.directive";
import { Entity } from "#src/app/core/entity/model/entity";
import { Component, Input } from "@angular/core";
import { ReactiveFormsModule } from "@angular/forms";
import { MatFormFieldControl } from "@angular/material/form-field";
import { CustomFormControlDirective } from "../../../common-components/basic-autocomplete/custom-form-control.directive";
import { EditComponent } from "./edit-component.interface";

@Component({
  selector: "app-dynamic-edit",
  imports: [DynamicComponentDirective, ReactiveFormsModule],
  templateUrl: "./dynamic-edit.component.html",
  styleUrl: "./dynamic-edit.component.scss",
  providers: [
    { provide: MatFormFieldControl, useExisting: DynamicEditComponent },
  ],
})
export class DynamicEditComponent
  extends CustomFormControlDirective<any>
  implements EditComponent
{
  @Input() formFieldConfig: FormFieldConfig;
  @Input() entity: Entity;
}
<ng-container
  [appDynamicComponent]="{
    component: formFieldConfig.editComponent,
    config: {
      ngControl: ngControl,
      formFieldConfig: formFieldConfig,
      entity: entity,
    },
  }"
>
</ng-container>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""