Skip to content

There is no way to access inputs or outputs of Components created by NgComponentOutlet  #15360

@mcweiss

Description

@mcweiss

I'm submitting a ... (check one with "x")

[ ] bug report => search github for a similar issue or PR before submitting
[x] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior
There is no way to set @inputs or subscribe to @output events of the Component created by NgComponentOutlet.

Expected behavior
I expect some to set values and to subscribe events.

What is the motivation / use case for changing the behavior?
At least, we should have the same level of functionality as ViewContainerRef.createComponent() which is roughly the programatic equivalent of NgComponentOutlet. That function returns a ComponentRef<any> which provides an instance property that allows direct access to the class instance of the Component. The original feature request for NgComponentOutlet defined an event on the directive that would fire and pass this ComponentRef object after creation. This did not make it into the current implementation and I see no other alternatives to access inputs/outputs.

Supporting only Components with no inputs or outputs severely limits the usefulness of NgComponentOutlet.

  • Angular version: 4.0.0-rc.1

Metadata

Metadata

Labels

area: commonIssues related to APIs in the @angular/common packagefeatureIssue 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