IssueRaiser

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

**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

Posted by mcweiss on Mar 21, 2017, 6:13 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.4,500 issues0 comments

support (Software)

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

mcweissMar 21, 2017, 6:13 PM

**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

Comments (0)

No comments yet. Start the discussion.

Comment on this issue