8000 How to access the host component from a directive ? · Issue #8277 · angular/angular · GitHub
[go: up one dir, main page]

Skip to content
How to access the host component from a directive ? #8277
@frankpepermans

Description

@frankpepermans

According to the change log (https://github.com/angular/angular/blob/master/CHANGELOG.md),
AppViewManager is renamed into ViewUtils and is a mere private utility service.

However, I was using AppViewManager.getComponent to obtain a Component reference from an ElementRef before, how would I do this now?

What I need to achieve is the following:

  • I have a Component with a selector (say: selector my-component)
  • A directive that can be placed upon Components (my-directive)

In HTML, it looks as following
<my-component my-directive></my-component>

From my-directive, I need to have a reference to the my-component Component instance.

If there is another (better) way of doing this, I'm happy to adapt my code

Metadata

Metadata

Assignees

Labels

area: coreIssues related to the framework runtimecore: difeatureIssue that requests a new featurefeature: under considerationFeature request for which voting has completed and the request is now under consideration

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0