src/app/core/default-values/x-dynamic-placeholder/admin-default-value-dynamic/admin-default-value-dynamic.component.ts
CustomFormControlDirective<DefaultValueConfigDynamic>
| changeDetection | ChangeDetectionStrategy.OnPush |
| providers |
AdminDefaultValueDynamicComponent
|
| selector | app-admin-default-value-dynamic |
| standalone | true |
| imports |
MatOption
MatSelect
MatTooltip
|
| styleUrls | ./admin-default-value-dynamic.component.scss |
| templateUrl | ./admin-default-value-dynamic.component.html |
| styleUrl | ./admin-default-value-dynamic.component.scss |
MatOption
MatSelect
MatTooltip
ReactiveFormsModule
CustomFormControlDirective<DefaultValueConfigDynamic>
OnInit
Properties |
|
Methods |
Inputs |
Outputs |
| aria-describedby | |
Type : string
|
|
|
Inherited from
CustomFormControlDirective
|
|
| disabled | |
Type : boolean
|
|
|
Inherited from
CustomFormControlDirective
|
|
| ngControl | |
Type : any
|
|
Default value : inject(NgControl, { optional: true, self: true })
|
|
|
Inherited from
CustomFormControlDirective
|
|
| placeholder | |
Type : string
|
|
|
Inherited from
CustomFormControlDirective
|
|
| required | |
Type : boolean
|
|
|
Inherited from
CustomFormControlDirective
|
|
| value | |
Type : T
|
|
|
Inherited from
CustomFormControlDirective
|
|
| valueChange | |
Type : EventEmitter
|
|
|
Inherited from
CustomFormControlDirective
|
|
| blur |
blur()
|
|
Inherited from
CustomFormControlDirective
|
|
Returns :
void
|
| focus |
focus()
|
|
Inherited from
CustomFormControlDirective
|
|
Returns :
void
|
| onContainerClick | ||||||
onContainerClick(event: MouseEvent)
|
||||||
|
Inherited from
CustomFormControlDirective
|
||||||
|
Parameters :
Returns :
void
|
| registerOnChange | ||||||
registerOnChange(fn: any)
|
||||||
|
Inherited from
CustomFormControlDirective
|
||||||
|
Parameters :
Returns :
void
|
| registerOnTouched | ||||||
registerOnTouched(fn: any)
|
||||||
|
Inherited from
CustomFormControlDirective
|
||||||
|
Parameters :
Returns :
void
|
| setDescribedByIds | ||||||
setDescribedByIds(ids: string[])
|
||||||
|
Inherited from
CustomFormControlDirective
|
||||||
|
Parameters :
Returns :
void
|
| setDisabledState | ||||||
setDisabledState(isDisabled: boolean)
|
||||||
|
Inherited from
CustomFormControlDirective
|
||||||
|
Parameters :
Returns :
void
|
| writeValue | |||||||||||||||
writeValue(value: T, notifyFormControl: unknown)
|
|||||||||||||||
|
Inherited from
CustomFormControlDirective
|
|||||||||||||||
|
Implementation for Angular ControlValueAccessor interface that links the form control value to the component value
Parameters :
Returns :
void
|
| internalControl |
Type : FormControl<string>
|
| controlType |
Type : string
|
Default value : "custom-control"
|
|
Inherited from
CustomFormControlDirective
|
| elementRef |
Type : unknown
|
Default value : inject<ElementRef<HTMLElement>>(ElementRef)
|
|
Inherited from
CustomFormControlDirective
|
| Readonly enabled |
Type : Signal<boolean>
|
Default value : computed(() => !this._disabled())
|
|
Inherited from
CustomFormControlDirective
|
|
Whether the control is currently enabled, as a signal (tracks disabled). |
| errorStateMatcher |
Type : unknown
|
Default value : inject(ErrorStateMatcher)
|
|
Inherited from
CustomFormControlDirective
|
| id |
Type : unknown
|
Default value : `custom-form-control-${CustomFormControlDirective.nextId++}`
|
|
Inherited from
CustomFormControlDirective
|
| Static nextId |
Type : number
|
Default value : 0
|
|
Inherited from
CustomFormControlDirective
|
| onChange |
Type : unknown
|
Default value : () => {...}
|
|
Inherited from
CustomFormControlDirective
|
| onTouched |
Type : unknown
|
Default value : () => {...}
|
|
Inherited from
CustomFormControlDirective
|
| parentForm |
Type : unknown
|
Default value : inject(NgForm, { optional: true })
|
|
Inherited from
CustomFormControlDirective
|
| parentFormGroup |
Type : unknown
|
Default value : inject(FormGroupDirective, { optional: true })
|
|
Inherited from
CustomFormControlDirective
|
| stateChanges |
Type : unknown
|
Default value : new Subject<void>()
|
|
Inherited from
CustomFormControlDirective
|
| Readonly valueSignal |
Type : Signal<T>
|
Default value : computed(() => this._value())
|
|
Inherited from
CustomFormControlDirective
|
|
The current value of the control as a signal.
Authoritative in both modes: it reflects the bound |
import { Component, OnInit, ChangeDetectionStrategy } from "@angular/core";
import { FormControl, ReactiveFormsModule } from "@angular/forms";
import { CustomFormControlDirective } from "../../../common-components/basic-autocomplete/custom-form-control.directive";
import { DefaultValueConfigDynamic } from "../default-value-config-dynamic";
import { MatOption, MatSelect } from "@angular/material/select";
import { MatTooltip } from "@angular/material/tooltip";
import { MatFormFieldControl } from "@angular/material/form-field";
@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: "app-admin-default-value-dynamic",
imports: [MatOption, MatSelect, MatTooltip, ReactiveFormsModule],
templateUrl: "./admin-default-value-dynamic.component.html",
styleUrl: "./admin-default-value-dynamic.component.scss",
providers: [
{
provide: MatFormFieldControl,
useExisting: AdminDefaultValueDynamicComponent,
},
],
})
export class AdminDefaultValueDynamicComponent
extends CustomFormControlDirective<DefaultValueConfigDynamic>
implements OnInit
{
internalControl: FormControl<string>;
ngOnInit() {
this.internalControl = new FormControl(this.value?.value);
this.internalControl.valueChanges.subscribe(
(v) => (this.value = { value: v }),
);
}
}
<mat-select [formControl]="internalControl">
<mat-option
value="$now"
matTooltip="Fill the current date initially, when a record is created."
i18n-matTooltip
i18n
>Current Date
</mat-option>
<mat-option
value="$current_user"
matTooltip="Fill the currently logged in user, when a record is created."
i18n-matTooltip
i18n
>Current User
</mat-option>
</mat-select>
./admin-default-value-dynamic.component.scss
mat-select {
font-style: italic;
}