简体   繁体   中英

Angular 2, sub-components of dynamic component are not rendered

I'm using this method

<ng-container
   *ngComponentOutlet="myComponent">
</ng-container>

to inject one component into another component, in my case a form into a sidebar. However from the injected component (the form) I cannot use pipes and shared components of the application. No component or pipe present in the shared.module is recognized within the injected component. How can I make shared components available in the component injected through ngComponentOutlet?

I did it, but : I did it using the component factory angular-comp-factory . But actually I have another question: My component is getting rendered but without its sub-components. How can I render its sub-components using the component factory?

I managed. It was only a problem with the arrangement of the modules.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM