Spec-Zone.ru › Angular

readonly

Adds logic to a field to conditionally make it readonly. A readonly field does not contribute to the validation, touched/dirty, or other state of its parent field.

API

function readonly<TValue, TPathKind extends PathKind = PathKind.Root>(
  path: SchemaPath<TValue, 1, TPathKind>,
  config?:
    | { when?: NoInfer<LogicFn<TValue, boolean, TPathKind>> | undefined }
    | undefined,
): void;
function readonly<TValue, TPathKind extends PathKind = PathKind.Root>(
  path: SchemaPath<TValue, 1, TPathKind>,
  logic?: NoInfer<LogicFn<TValue, boolean, TPathKind>> | undefined,
): void;
function readonly<TValue, TPathKind = PathKind.Root>(path: SchemaPath<TValue, 1, TPathKind>, config?: { when?: NoInfer<LogicFn<TValue, boolean, TPathKind>> | undefined; } | undefined): void;

Adds logic to a field to conditionally make it readonly. A readonly field does not contribute to the validation, touched/dirty, or other state of its parent field.

@parampathSchemaPath<TValue, 1, TPathKind>

The target path to make readonly.

@paramconfig{ when?: NoInfer<LogicFn<TValue, boolean, TPathKind>> | undefined; } | undefined

Optional configuration object.

  • when: A reactive function that returns true when the field is readonly.
@returnsvoid
function readonly<TValue, TPathKind = PathKind.Root>(path: SchemaPath<TValue, 1, TPathKind>, logic?: NoInfer<LogicFn<TValue, boolean, TPathKind>> | undefined): void;

Adds logic to a field to conditionally make it readonly.

@deprecated

Passing a function directly to readonly is deprecated. Use { when: ... } instead.

@parampathSchemaPath<TValue, 1, TPathKind>
@paramlogicNoInfer<LogicFn<TValue, boolean, TPathKind>> | undefined
@returnsvoid

Super-powered by Google ©2010–2025.
Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0.
https://angular.dev/api/forms/signals/readonly

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API