This reverts commit a647298412
.
PR Close #32088
This commit is contained in:
parent
3df54be9e4
commit
9a37e827e2
|
@ -36,7 +36,7 @@ export abstract class NgControl extends AbstractControlDirective {
|
||||||
* @description
|
* @description
|
||||||
* The name for the control
|
* The name for the control
|
||||||
*/
|
*/
|
||||||
name: string|number|null = null;
|
name: string|null = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description
|
* @description
|
||||||
|
|
|
@ -145,13 +145,9 @@ export class FormControlName extends NgControl implements OnChanges, OnDestroy {
|
||||||
* @description
|
* @description
|
||||||
* Tracks the name of the `FormControl` bound to the directive. The name corresponds
|
* Tracks the name of the `FormControl` bound to the directive. The name corresponds
|
||||||
* to a key in the parent `FormGroup` or `FormArray`.
|
* to a key in the parent `FormGroup` or `FormArray`.
|
||||||
* Accepts a name as a string or a number.
|
|
||||||
* The name in the form of a string is useful for individual forms,
|
|
||||||
* while the numerical form allows for form controls to be bound
|
|
||||||
* to indices when iterating over controls in a `FormArray`.
|
|
||||||
*/
|
*/
|
||||||
// TODO(issue/24571): remove '!'.
|
// TODO(issue/24571): remove '!'.
|
||||||
@Input('formControlName') name !: string | number | null;
|
@Input('formControlName') name !: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description
|
* @description
|
||||||
|
@ -242,9 +238,7 @@ export class FormControlName extends NgControl implements OnChanges, OnDestroy {
|
||||||
* Returns an array that represents the path from the top-level form to this control.
|
* Returns an array that represents the path from the top-level form to this control.
|
||||||
* Each index is the string name of the control on that level.
|
* Each index is the string name of the control on that level.
|
||||||
*/
|
*/
|
||||||
get path(): string[] {
|
get path(): string[] { return controlPath(this.name, this._parent !); }
|
||||||
return controlPath(this.name == null ? this.name : this.name.toString(), this._parent !);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description
|
* @description
|
||||||
|
|
|
@ -28,8 +28,8 @@ import {SelectMultipleControlValueAccessor} from './select_multiple_control_valu
|
||||||
import {AsyncValidator, AsyncValidatorFn, Validator, ValidatorFn} from './validators';
|
import {AsyncValidator, AsyncValidatorFn, Validator, ValidatorFn} from './validators';
|
||||||
|
|
||||||
|
|
||||||
export function controlPath(name: string | null, parent: ControlContainer): string[] {
|
export function controlPath(name: string, parent: ControlContainer): string[] {
|
||||||
return [...parent.path !, name !];
|
return [...parent.path !, name];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setUpControl(control: FormControl, dir: NgControl): void {
|
export function setUpControl(control: FormControl, dir: NgControl): void {
|
||||||
|
|
|
@ -255,7 +255,7 @@ export declare class FormControlName extends NgControl implements OnChanges, OnD
|
||||||
readonly formDirective: any;
|
readonly formDirective: any;
|
||||||
isDisabled: boolean;
|
isDisabled: boolean;
|
||||||
/** @deprecated */ model: any;
|
/** @deprecated */ model: any;
|
||||||
name: string | number | null;
|
name: string;
|
||||||
readonly path: string[];
|
readonly path: string[];
|
||||||
/** @deprecated */ update: EventEmitter<any>;
|
/** @deprecated */ update: EventEmitter<any>;
|
||||||
readonly validator: ValidatorFn | null;
|
readonly validator: ValidatorFn | null;
|
||||||
|
@ -353,7 +353,7 @@ export declare const NG_VALUE_ACCESSOR: InjectionToken<ControlValueAccessor>;
|
||||||
|
|
||||||
export declare abstract class NgControl extends AbstractControlDirective {
|
export declare abstract class NgControl extends AbstractControlDirective {
|
||||||
readonly asyncValidator: AsyncValidatorFn | null;
|
readonly asyncValidator: AsyncValidatorFn | null;
|
||||||
name: string | number | null;
|
name: string | null;
|
||||||
readonly validator: ValidatorFn | null;
|
readonly validator: ValidatorFn | null;
|
||||||
valueAccessor: ControlValueAccessor | null;
|
valueAccessor: ControlValueAccessor | null;
|
||||||
abstract viewToModelUpdate(newValue: any): void;
|
abstract viewToModelUpdate(newValue: any): void;
|
||||||
|
|
Loading…
Reference in New Issue