Skip to content
@ng-doc/app / Class

NgDocJsonControlComponent

The playground control of array inputs that have no list control, such as Item[] or [string, number]: a text area that holds the value as JSON.

Text that parses sets the value; while the text is not JSON, the field is marked as invalid and the input keeps its last valid value. An empty field is undefined, and the value that the playground writes is shown as JSON again, so the text and the value always match. It edits any value that JSON can hold, so it can also be registered for an object type.

Decorators
@Component
Selectors
ng-doc-json-control
Generic types
T
Extends
DIControl<T | undefined, T | undefined>
Implements
NgDocTypeControl<T | undefined>
DeclarationTypeScript
@Component({ … })
export class NgDocJsonControlComponent<T = unknown>
  extends DIControl<T | undefined>
  implements NgDocTypeControl<T | undefined> { … }

Members

Constructor

1
()
—

Properties

15
change: (value: T | null) => void
protected inherited from DIControlValueAccessor
—
changeDetectorRef: ChangeDetectorRef
protectedreadonly inherited from DIControlValueAccessor
—
config?: DIControlConfig<TModel, TChildModel> | undefined
protectedreadonly inherited from DIControl
—
disabledValue: WritableSignal<boolean>
protectedreadonly inherited from DIControlValueAccessor
—
elementRef: ElementRef<HTMLElement>
protectedreadonly inherited from DIControlValueAccessor
—
errorId: string
protectedreadonly

ID of the message that describes invalid text.

incomingUpdate?: ((value: T | null) => void) | undefined
protectedreadonly inherited from DIControlValueAccessor
—
invalid: WritableSignal<boolean>
protectedreadonly

Whether the text is not JSON.

model: Signal<T | null>
protectedreadonly inherited from DIControlValueAccessor
—
ngControl: NgControl | null
protectedreadonly inherited from DIControlValueAccessor
—
renderer: Renderer2
protectedreadonly inherited from DIControlValueAccessor
—
rows: Signal<number>
protectedreadonly

The rows of the field: its lines, from 2 to 10.

text: WritableSignal<string>
protectedreadonly

The text of the field.

protectedreadonly
—
touch: () => void
protected inherited from DIControl

Function that should be used to make control touched.

Accessors

3
get disabled: boolean
inherited from DIControlValueAccessor

Returns true if the control is disabled.

set disabled: boolean
inherited from DIControlValueAccessor
—
get hasValue: boolean
inherited from DIControlValueAccessor

Returns true if the control is not empty.

Methods

5
(…): void
protected

Sets the value from the text of the field, when it is JSON.

(): void
inherited from DIControl
—
(…): void
inherited from DIControl

Method is called by the forms API.

(…): void
inherited from DIControl

Updates the model of the current control. This is the main method that should be used to update the model.

(…): void
overrides DIControl

Method is called by the forms API to write to the view when programmatic changes from model to view are requested.

Symbol
Kind
Class
Decorators
@Component
Selectors
ng-doc-json-control
Generic types
T
Extends
DIControl<T | undefined, T | undefined>
Implements
NgDocTypeControl<T | undefined>
Scope
@ng-doc/app
Edit this page