-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot pass events #5
Comments
What version are you using? Can you repeat the problem on stackblitz.com? Also, you do not need to use HostComponent for your dynamics. This feature is marked as deprecated due to its complexity of use. Instead, use *ngxComponentOutlet on ng-container as a structural directive. The directive will make a bindings on your component automatically. |
Same issue: "event not caught when emitted by x instance":
|
@ciukstar you can't do it that way. You need to create an |
Thank you! Now I got it. There must be at least three |
how can we emit event from parent to child components |
@balajibadly, you can use the output of the directive (ngxComponentOutletActivate) to get the component instance and then send any event to the component |
can i have any stackBlitz example @thekiba ? |
no rply ? |
You have to use (ngxComponentOutletActivate) in the template:
And then you'll get a component instance in onActivate callback
|
how to trigger this onActivateEvent in a click function! |
I have 2 dynamic components with events.
First dymamic component have few events:
Output('action1') action1= new EventEmitter<any>();
Output('action2') action2= new EventEmitter<any>();
Output('action3') action3= new EventEmitter<any>();
Also i have host component for this dynamic components. All components registered in
declarations
/entry components
HTML of host:
<ng-container *ngxComponentOutlet="component; context: {data: data}">
events in host, like in first dynamic component:
Output('action1') action1= new EventEmitter<any>();
Output('action2') action2= new EventEmitter<any>();
Output('action3') action3= new EventEmitter<any>();
and events doesnt fires on in host wrapper component:
Why I cant reach those
onAction1/2/3()
functions in my wrapper? IDE autocomplete tells me that I have this events, but they doesnt fire. Help pleaseUPD:
seems like it works when event name isn't specified (
Output('action2') action2 = ... => Output() action2 = ....
)The text was updated successfully, but these errors were encountered: