Skip to content

Better ViewChild support for multiple instances of child component #21542

@theactiveactor

Description

@theactiveactor

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[X] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

When a parent component hosts multiple instances of the same child component type, it's unnecessarily difficult to obtain reference to a specific instance. The only way I'm aware of is with ViewChildren, so I have to traverse a list.

Expected behavior

ViewChild should support directly addressing a component by some identifier, e.g. the view template reference.

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreIssues related to the framework runtimefeatureLabel used to distinguish feature request from other issues

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions