GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing angular.dev — FormGroup • Angular API Creates a new @paramcontrols TControlA collection of child controls. The key for each child is the name under which it is registered. @paramvalidatorOrOpts ValidatorFn | AbstractControlOptions | ValidatorFn[] | null | undefinedA synchronous validator function, or an array of
such functions, or an @paramasyncValidator AsyncValidatorFn | AsyncValidatorFn[] | null | undefinedA single async validator or array of async validator functions @returns FormGroup<TControl>Registers a control with the group's list of controls. In a strongly-typed group, the control must be in the group's type (possibly as an optional key). This method does not update the value or validity of the control.
Use @paramname KThe control name to register in the collection @paramcontrol TControl[K]Provides the control for the given name @returns TControl[K]@paramname string@returns AbstractControl<any, any, any>Add a control to this group. In a strongly-typed group, the control must be in the group's type (possibly as an optional key). If a control with a given name already exists, it would not be replaced with a new one.
If you want to replace an existing control, use the @paramname stringThe control name to add to the collection @paramoptions { emitEvent?: boolean | undefined; } | undefinedSpecifies whether this FormGroup instance should emit events after a new control is added.
@returns void@paramname K@paramcontrol Required<TControl>[K]@paramoptions { emitEvent?: boolean | undefined; } | undefined@returns void@paramname string@paramoptions { emitEvent?: boolean | undefined; } | undefined@returns void@paramname ɵOptionalKeys<TControl> & S@paramoptions { emitEvent?: boolean | undefined; } | undefined@returns voidReplace an existing control. In a strongly-typed group, the control must be in the group's type (possibly as an optional key). If a control with a given name does not exist in this @paramname KThe control name to replace in the collection @paramcontrol TControl[K]Provides the control for the given name @paramoptions { emitEvent?: boolean | undefined; } | undefinedSpecifies whether this FormGroup instance should emit events after an existing control is replaced.
@returns void@paramname string@paramoptions { emitEvent?: boolean | undefined; } | undefined@returns voidCheck whether there is an enabled control with the given name in the group. Reports false for disabled controls. If you'd like to check for existence in the group
only, use @paramcontrolName KThe control name to check for existence in the collection @returns booleanfalse for disabled controls, true otherwise. @paramcontrolName string@returns booleanSets the value of the @paramvalue ɵIsAny<TControl, { [key: string]: any; }, { [K in keyof TControl]: ɵRawValue<TControl[K]>; }>The new value for the control that matches the structure of the group. @paramoptions { onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; }Configuration options that determine how the control propagates changes
and emits events after the value changes.
The configuration options are passed to the
@returns voidUsage notes Set the complete value for the form group
Patches the value of the It accepts both super-sets and sub-sets of the group without throwing an error. @paramvalue ɵIsAny<TControl, { [key: string]: any; }, Partial<{ [K in keyof TControl]: ɵValue<TControl[K]>; }>>The object that matches the structure of the group. @paramoptions { onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; }Configuration options that determine how the control propagates changes and emits events after the value is patched.
@returns voidUsage notes Patch the value for a form group
Resets the You reset to a specific form state by passing in a map of states that matches the structure of your form, with control names as keys. The state is a standalone value or a form state object with both a value and a disabled status. @paramvalue ɵTypedOrUntyped<TControl, ɵIsAny<TControl, { [key: string]: any; }, Partial<{ [K in keyof TControl]: ɵValue<TControl[K]> | FormControlState<ɵValue<TControl[K]>>; }>>, any>Resets the control with an initial value, or an object that defines the initial value and disabled state. @paramoptions { onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; overwriteDefaultValue?: boolean | undefined; }Configuration options that determine how the control propagates changes and emits events when the group is reset.
@returns voidUsage notes Reset the form group values
Reset the form group values and disabled status
The aggregate value of the Retrieves all values regardless of disabled status. @returns ɵTypedOrUntyped<TControl, ɵIsAny<TControl, { [key: string]: any; }, { [K in keyof TControl]: ɵRawValue<TControl[K]>; }>, any>The current value of the control.
Returns the function that is used to determine the validity of this control synchronously.
If multiple validators have been added, this will be a single composed function.
See Returns the function that is used to determine the validity of this control asynchronously.
If multiple validators have been added, this will be a single composed function.
See The parent control. The validation status of the control. A control is A control is A control is A control is Disabled controls are exempt from validation checks and are not included in the aggregate value of their ancestor controls. A control is An object containing any errors generated by failing validation, or null if there are no errors. A control is A control is True if the control is marked as A control is marked True if the control has not been marked as touched A control is A multicasting observable that emits an event every time the state of the control changes. It emits for value, status, pristine or touched changes. Note: On value change, the emit happens right after a value of this control is updated. The
value of a parent control (for example if this FormControl is a part of a FormGroup) is updated
later, so accessing a value of a parent control (using the A multicasting observable that emits an event every time the value of the control changes, in the UI or programmatically. It also emits an event each time you call enable() or disable() without passing along {emitEvent: false} as a function argument. Note: the emit happens right after a value of this control is updated. The value of a
parent control (for example if this FormControl is a part of a FormGroup) is updated later, so
accessing a value of a parent control (using the A multicasting observable that emits an event every time the validation Reports the update strategy of the Sets the synchronous validators that are active on this control. Calling this overwrites any existing synchronous validators. When you add or remove a validator at run time, you must call
If you want to add a new validator without affecting existing ones, consider
using @returns voidSets the asynchronous validators that are active on this control. Calling this overwrites any existing asynchronous validators. When you add or remove a validator at run time, you must call
If you want to add a new validator without affecting existing ones, consider
using @returns voidAdd a synchronous validator or validators to this control, without affecting other validators. When you add or remove a validator at run time, you must call
Adding a validator that already exists will have no effect. If duplicate validator functions
are present in the @paramvalidators ValidatorFn | ValidatorFn[]The new validator function or functions to add to this control. @returns voidAdd an asynchronous validator or validators to this control, without affecting other validators. When you add or remove a validator at run time, you must call
Adding a validator that already exists will have no effect. @paramvalidators AsyncValidatorFn | AsyncValidatorFn[]The new asynchronous validator function or functions to add to this control. @returns voidRemove a synchronous validator from this control, without affecting other validators. Validators are compared by function reference; you must pass a reference to the exact same validator function as the one that was originally set. If a provided validator is not found, it is ignored. @returns voidUsage notes
When you add or remove a validator at run time, you must call
Remove an asynchronous validator from this control, without affecting other validators. Validators are compared by function reference; you must pass a reference to the exact same validator function as the one that was originally set. If a provided validator is not found, it is ignored. When you add or remove a validator at run time, you must call
@paramvalidators AsyncValidatorFn | AsyncValidatorFn[]The asynchronous validator or validators to remove. @returns voidCheck whether a synchronous validator function is present on this control. The provided validator must be a reference to the exact same function that was provided. @returns booleanWhether the provided validator was found on this control. Usage notes
Check whether an asynchronous validator function is present on this control. The provided validator must be a reference to the exact same function that was provided. @paramvalidator AsyncValidatorFnThe asynchronous validator to check for presence. Compared by function reference. @returns booleanWhether the provided asynchronous validator was found on this control. Empties out the synchronous validator list. When you add or remove a validator at run time, you must call
@returns voidEmpties out the async validator list. When you add or remove a validator at run time, you must call
@returns voidMarks the control as @paramopts { onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; } | undefinedConfiguration options that determine how the control propagates changes and emits events after marking is applied.
@returns void@paramopts { onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; sourceControl?: AbstractControl<any, any, any> | undefined; } | undefined@returns voidMarks the control and all its descendant controls as @paramopts { emitEvent?: boolean | undefined; }Configuration options that determine how the control propagates changes and emits events after marking is applied.
@returns voidMarks the control and all its descendant controls as @paramopts { emitEvent?: boolean | undefined; }Configuration options that determine how the control propagates changes and emits events after marking is applied.
@returns voidMarks the control as If the control has any children, also marks all children as @paramopts { onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; } | undefinedConfiguration options that determine how the control propagates changes and emits events after the marking is applied.
@returns void@paramopts { onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; sourceControl?: AbstractControl<any, any, any> | undefined; }@returns voidMarks the control as @paramopts { onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; } | undefinedConfiguration options that determine how the control propagates changes and emits events after marking is applied.
@returns void@paramopts { onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; sourceControl?: AbstractControl<any, any, any> | undefined; }@returns voidMarks the control as If the control has any children, marks all children as @paramopts { onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; } | undefinedConfiguration options that determine how the control emits events after marking is applied.
@returns void@paramopts { onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; sourceControl?: AbstractControl<any, any, any> | undefined; }@returns voidMarks the control as A control is pending while the control performs async validation. @paramopts { onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; } | undefinedConfiguration options that determine how the control propagates changes and emits events after marking is applied.
@returns void@paramopts { onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; sourceControl?: AbstractControl<any, any, any> | undefined; }@returns voidDisables the control. This means the control is exempt from validation checks and
excluded from the aggregate value of any parent. Its status is If the control has children, all children are also disabled. @paramopts { onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; } | undefinedConfiguration options that determine how the control propagates changes and emits events after the control is disabled.
@returns void@paramopts { onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; sourceControl?: AbstractControl<any, any, any> | undefined; }@returns voidEnables the control. This means the control is included in validation checks and the aggregate value of its parent. Its status recalculates based on its value and its validators. By default, if the control has children, all children are enabled. @paramopts { onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; }Configure options that control how the control propagates changes and emits events when marked as untouched
@returns voidRecalculates the value and validation status of the control. By default, it also updates the value and validity of its ancestors. @paramopts { onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; } | undefinedConfiguration options determine how the control propagates changes and emits events after updates and validity checks are applied.
@returns void@paramopts { onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; sourceControl?: AbstractControl<any, any, any> | undefined; }@returns voidSets errors on a form control when running validations manually, rather than automatically. Calling Note: Manually set errors are always overwritten by the results of the next validation run. @paramopts { emitEvent?: boolean | undefined; } | undefinedConfiguration options that determine how the control propagates changes and emits events after the control errors are set.
@returns voidUsage notes Manually set the errors for a control
@paramopts { emitEvent?: boolean | undefined; shouldHaveEmitted?: boolean | undefined; } | undefined@returns voidRetrieves a child control given the control's name or path. This signature for get supports strings and @parampath P@returns AbstractControl<ɵGetProperty<TRawValue, P>, ɵGetProperty<TRawValue, P>, any> | nullRetrieves a child control given the control's name or path. This signature for @parampath P@returns AbstractControl<ɵGetProperty<TRawValue, P>, ɵGetProperty<TRawValue, P>, any> | nullReports error data for the control with the given path. @paramerrorCode stringThe code of the error to check @parampath string | (string | number)[] | undefinedA list of control names that designates how to move from the current control to the control that should be queried for errors. @returns anyerror data for that particular error. If the control or error is not present, null is returned. Usage notes For example, for the following
The path to the 'street' control from the root form would be 'address' -> 'street'. It can be provided to this method in one of two formats:
Reports whether the control with the given path has the error specified. @paramerrorCode stringThe code of the error to check @parampath string | (string | number)[] | undefinedA list of control names that designates how to move from the current control to the control that should be queried for errors. @returns booleanwhether the given error is present in the control at the given path. If the control is not present, false is returned. Usage notes For example, for the following
The path to the 'street' control from the root form would be 'address' -> 'street'. It can be provided to this method in one of two formats:
If no path is given, this method checks for the error on the current control. Retrieves the top-level ancestor of this control. DescriptionTracks the value and validity state of a group of A
When instantiating a
Usage NotesCreate a form group with 2 controls
The type argument, and optional controls
If you have controls that are optional (i.e. they can be removed, you can use the
Create a form group with a group-level validatorYou include group-level validators as the second arg, or group-level async validators as the third arg. These come in handy when you want to perform validation that considers the value of more than one child control.
Like
Set the updateOn property for all controls in a form groupThe options object is used to set a default value for each child
control's
Using a FormGroup with optional controlsIt is possible to have optional controls in a FormGroup. An optional control can be removed later
using
Notice that |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |