docs(forms): Deprecate legacy options for FormBuilder.group (#39769)
DEPRECATION: Mark the {[key: string]: any} type for the options property of the FormBuilder.group method as deprecated. Using AbstractControlOptions gives the same functionality and is type-safe. PR Close #39769
This commit is contained in:
parent
c43267b912
commit
e148382bd0
|
@ -31,6 +31,8 @@ v7 - v10
|
||||||
v8 - v11
|
v8 - v11
|
||||||
v9 - v12
|
v9 - v12
|
||||||
v10 - v13
|
v10 - v13
|
||||||
|
v11 - v14
|
||||||
|
v12 - v15
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,6 +57,7 @@ v10 - v13
|
||||||
| `@angular/router` | [`loadChildren` string syntax](#loadChildren) | <!--v9--> v11 |
|
| `@angular/router` | [`loadChildren` string syntax](#loadChildren) | <!--v9--> v11 |
|
||||||
| `@angular/core/testing` | [`TestBed.get`](#testing) | <!--v9--> v12 |
|
| `@angular/core/testing` | [`TestBed.get`](#testing) | <!--v9--> v12 |
|
||||||
| `@angular/core/testing` | [`async`](#testing) | <!--v9--> v12 |
|
| `@angular/core/testing` | [`async`](#testing) | <!--v9--> v12 |
|
||||||
|
| `@angular/forms` | [`FormBuilder.group` legacy options parameter](api/forms/FormBuilder#group) | <!--v11--> v14 |
|
||||||
| `@angular/router` | [`ActivatedRoute` params and `queryParams` properties](#activatedroute-props) | unspecified |
|
| `@angular/router` | [`ActivatedRoute` params and `queryParams` properties](#activatedroute-props) | unspecified |
|
||||||
| template syntax | [`/deep/`, `>>>`, and `::ng-deep`](#deep-component-style-selector) | <!--v7--> unspecified |
|
| template syntax | [`/deep/`, `>>>`, and `::ng-deep`](#deep-component-style-selector) | <!--v7--> unspecified |
|
||||||
|
|
||||||
|
@ -108,6 +111,7 @@ Tip: In the [API reference section](api) of this doc site, deprecated APIs are i
|
||||||
| API | Replacement | Deprecation announced | Notes |
|
| API | Replacement | Deprecation announced | Notes |
|
||||||
| --- | ----------- | --------------------- | ----- |
|
| --- | ----------- | --------------------- | ----- |
|
||||||
| [`ngModel` with reactive forms](#ngmodel-reactive) | [`FormControlDirective`](api/forms/FormControlDirective) | v6 | none |
|
| [`ngModel` with reactive forms](#ngmodel-reactive) | [`FormControlDirective`](api/forms/FormControlDirective) | v6 | none |
|
||||||
|
| [`FormBuilder.group` legacy options parameter](api/forms/FormBuilder#group) | [`AbstractControlOptions` parameter value](api/forms/AbstractControlOptions) | v11 | none |
|
||||||
|
|
||||||
|
|
||||||
{@a upgrade}
|
{@a upgrade}
|
||||||
|
|
|
@ -207,9 +207,12 @@ export declare class FormBuilder {
|
||||||
control(formState: any, validatorOrOpts?: ValidatorFn | ValidatorFn[] | AbstractControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null): FormControl;
|
control(formState: any, validatorOrOpts?: ValidatorFn | ValidatorFn[] | AbstractControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null): FormControl;
|
||||||
group(controlsConfig: {
|
group(controlsConfig: {
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}, options?: AbstractControlOptions | {
|
}, options?: AbstractControlOptions | null): FormGroup;
|
||||||
|
/** @deprecated */ group(controlsConfig: {
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
} | null): FormGroup;
|
}, options: {
|
||||||
|
[key: string]: any;
|
||||||
|
}): FormGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
export declare class FormControl extends AbstractControl {
|
export declare class FormControl extends AbstractControl {
|
||||||
|
|
|
@ -39,20 +39,38 @@ export class FormBuilder {
|
||||||
* @param controlsConfig A collection of child controls. The key for each child is the name
|
* @param controlsConfig A collection of child controls. The key for each child is the name
|
||||||
* under which it is registered.
|
* under which it is registered.
|
||||||
*
|
*
|
||||||
* @param options Configuration options object for the `FormGroup`. The object can
|
* @param options Configuration options object for the `FormGroup`. The object should have the
|
||||||
* have two shapes:
|
* the `AbstractControlOptions` type and might contain the following fields:
|
||||||
*
|
|
||||||
* 1) `AbstractControlOptions` object (preferred), which consists of:
|
|
||||||
* * `validators`: A synchronous validator function, or an array of validator functions
|
* * `validators`: A synchronous validator function, or an array of validator functions
|
||||||
* * `asyncValidators`: A single async validator or array of async validator functions
|
* * `asyncValidators`: A single async validator or array of async validator functions
|
||||||
* * `updateOn`: The event upon which the control should be updated (options: 'change' | 'blur' |
|
* * `updateOn`: The event upon which the control should be updated (options: 'change' | 'blur' |
|
||||||
* submit')
|
* submit')
|
||||||
|
*/
|
||||||
|
group(
|
||||||
|
controlsConfig: {[key: string]: any},
|
||||||
|
options?: AbstractControlOptions|null,
|
||||||
|
): FormGroup;
|
||||||
|
/**
|
||||||
|
* @description
|
||||||
|
* Construct a new `FormGroup` instance.
|
||||||
*
|
*
|
||||||
* 2) Legacy configuration object, which consists of:
|
* @deprecated This api is not typesafe and can result in issues with Closure Compiler renaming.
|
||||||
|
* Use the `FormBuilder#group` overload with `AbstractControlOptions` instead.
|
||||||
|
*
|
||||||
|
* @param controlsConfig A collection of child controls. The key for each child is the name
|
||||||
|
* under which it is registered.
|
||||||
|
*
|
||||||
|
* @param options Configuration options object for the `FormGroup`. The legacy configuration
|
||||||
|
* object consists of:
|
||||||
* * `validator`: A synchronous validator function, or an array of validator functions
|
* * `validator`: A synchronous validator function, or an array of validator functions
|
||||||
* * `asyncValidator`: A single async validator or array of async validator functions
|
* * `asyncValidator`: A single async validator or array of async validator functions
|
||||||
*
|
* Note: the legacy format is deprecated and might be removed in one of the next major versions
|
||||||
|
* of Angular.
|
||||||
*/
|
*/
|
||||||
|
group(
|
||||||
|
controlsConfig: {[key: string]: any},
|
||||||
|
options: {[key: string]: any},
|
||||||
|
): FormGroup;
|
||||||
group(
|
group(
|
||||||
controlsConfig: {[key: string]: any},
|
controlsConfig: {[key: string]: any},
|
||||||
options: AbstractControlOptions|{[key: string]: any}|null = null): FormGroup {
|
options: AbstractControlOptions|{[key: string]: any}|null = null): FormGroup {
|
||||||
|
|
Loading…
Reference in New Issue