Files
arturovt 38d093232c fix(forms): warn in dev mode when ngModel cannot reach parent NgForm across component boundary
NgModel injects ControlContainer with @Host(), which stops the injector at
the component host element boundary. When NgForm lives in a parent component
and ngModel lives in a child component, the injection returns null silently
and the control acts standalone — never registering with the form.

To surface this invisible failure, emit a dev-mode warning (NG01354) when
ngModel's @Host() injection finds nothing but the element Injector can still
reach a ControlContainer further up the hierarchy. The warning identifies the
cross-boundary issue and points developers to the viewProviders fix or the
standalone option.

Adds the NG01354 reference page explaining why the warning fires and providing
two remediation paths: bridging ControlContainer via viewProviders, or opting
out with [ngModelOptions]="{standalone: true}".

Fixes #47580
2026-08-17 13:59:40 -07:00

50 lines
1.3 KiB
Markdown

## API Report File for "forms_errors"
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
// @public
export const enum RuntimeErrorCode {
// (undocumented)
COMPAREWITH_NOT_A_FN = 1201,
// (undocumented)
FORM_ARRAY_NAME_MISSING_PARENT = 1054,
// (undocumented)
FORM_CONTROL_NAME_INSIDE_MODEL_GROUP = 1051,
// (undocumented)
FORM_CONTROL_NAME_MISSING_PARENT = 1050,
// (undocumented)
FORM_GROUP_MISSING_INSTANCE = 1052,
// (undocumented)
FORM_GROUP_NAME_MISSING_PARENT = 1053,
// (undocumented)
MISSING_CONTROL = 1001,
// (undocumented)
MISSING_CONTROL_VALUE = -1002,
// (undocumented)
NAME_AND_FORM_CONTROL_NAME_MUST_MATCH = 1202,
// (undocumented)
NG_MISSING_VALUE_ACCESSOR = -1203,
// (undocumented)
NG_VALUE_ACCESSOR_NOT_PROVIDED = 1200,
// (undocumented)
NGMODEL_IN_CHILD_COMPONENT = -1354,
// (undocumented)
NGMODEL_IN_FORM_GROUP = 1350,
// (undocumented)
NGMODEL_IN_FORM_GROUP_NAME = 1351,
// (undocumented)
NGMODEL_WITHOUT_NAME = 1352,
// (undocumented)
NGMODELGROUP_IN_FORM_GROUP = 1353,
// (undocumented)
NO_CONTROLS = 1000,
// (undocumented)
WRONG_VALIDATOR_RETURN_TYPE = -1101
}
// (No @packageDocumentation comment for this package)
```