Skip to content

Host directive with provider breaks viewProviders #65724

@waterplea

Description

@waterplea

Which @angular/* package(s) are the source of the bug?

core

Is this a regression?

No

Description

I was trying to use formControlName is a nested component which requires:

viewProviders: [{ provide: ControlContainer, useExisting: FormGroupDirective }],

Because formControlName injects parent formGroup directive with @Host decorator. But I noticed that it stops working as soon as one host directive on the component has any provider.

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/stackblitz-starters-fq1bt4pw

Please provide the exception or error you saw

RuntimeError: NG01050: formControlName must be used with a parent formGroup directive

Please provide the environment you discovered this bug in (run ng version)

20

Anything else?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions