Hi Sander,
I'm having a real hard time making the EventEmitter work for my case.
The documentation example is straight forward as you insert the child
component as a tag in the parent component's markup.
<my-voter ... (onVoted)="onVoted($event)">
</my-voter>
In my case, the child tag is the ng-content tag in my
page-layout.component, but it does of course not work.
<div style="background-color: red;">
<h2>page-layout.subtitle: {{subtitle}}</h2>
<ng-content (onSetTitle)="onSetTitle($event)"></ng-content>
</div>
Then I thought the page-layout tag in the assembly-list.component must be
the "real" parent but this doesn't work either.I get a Member 'onSetTitle'
is no callable which makes sense.
<page-layout (onSetTitle)="onSetTitle($event)">
<p>ToDo</p>
</page-layout>
I have found a similar problem at the link below, but I don't fully get the
solution (can't make it work):
https://stackoverflow.com/questions/43227652/angular-2-ng-content-receive-event-from-child-component
The link above links to a Plunker which looks similar to what I currently
got:
http://plnkr.co/edit/Kt7jpEwzKC8ljvKGLbKt?p=preview
Any suggestions?
I thought Angular should speed of my development. I have now spent several
hours on a simple problem that could have been solved with a single line of
jQuery :-)
--
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.