Sander,

I tried your first approach with @Output and EventEmitter in child
component, and it did not work with Angular event, since bubbling of it is
not supported, can't catch it in the container (parent).
I hope I understood your idea correctly...

Will try using native DOM event in child,
elementRef.nativeElement.dispatchEvent(new CustomEvent()).

Thank you,
Oleg.



On Aug 17, 2017 7:51 AM, "Sander Elias" <[email protected]> wrote:

> Hi Oleg,
>
> There are a lot of ways you can do this. There is even a
> special documentation <https://angular.io/guide/component-interaction>
> page about this subject.
>
>    1.  use an @Output, your parent can then listen for events submitted
>    by your child component.
>    2. use an service. Put in a service that provides an event(like)
>    system. you can then emit from your child, and listen in your main
>    3. inject the main component into the child-component, and call
>    methods on it directly.
>    4. what you said, but this is very error-prone
>    5. use localStorage as an event-bus
>    6. include a 3rth party event system
>
> I probably missed a a few ;)
>
> Regards
> Sander
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Angular and AngularJS discussion" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/angular/nY63ntXhWsg/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to