angular/packages/forms/src/directives/control_container.ts
Dylan Hunn c8e4d62882 refactor(forms): Split up model.ts. (#45217)
model.ts is currently extremely large. This is the first step in an attempt to refactor it to be more easily navigable and reviewable. This commit breaks up `model.ts` into the following new files:

* `model/abstract_model.ts`: The remainder of the model, including the `AbstractControl` base class and helper functions which are used throughout.
* `model/form_control.ts`: `FormControl`, `FormControlOptions`, and helpers, plus the constructor and untyped friends.
* `model/form_array.ts`: `FormArray` and untyped friends.
* `model/form_group.ts`: `FormGroup` and untyped friends.

This first phase is a purely mechanical code move. There is no new code at all, and no interfaces have been separated.

PR Close #45217
2022-03-01 19:49:31 +00:00

42 lines
938 B
TypeScript

/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {AbstractControlDirective} from './abstract_control_directive';
import {Form} from './form_interface';
/**
* @description
* A base class for directives that contain multiple registered instances of `NgControl`.
* Only used by the forms module.
*
* @publicApi
*/
export abstract class ControlContainer extends AbstractControlDirective {
/**
* @description
* The name for the control
*/
// TODO(issue/24571): remove '!'.
name!: string|number|null;
/**
* @description
* The top-level form directive for the control.
*/
get formDirective(): Form|null {
return null;
}
/**
* @description
* The path to this group.
*/
override get path(): string[]|null {
return null;
}
}