Reputation:
I have a basic question that I am struggling to find answers to online, it it alright to have two events or more per component reference i.e.:
<app-inputs (event)="getDataFromChild($event)",
(eventTwo)="getDataFromChildTwo($eventTwo)"></app-inputs>
Upvotes: 0
Views: 47
Reputation: 29715
There is no restriction to the number of events
(output events w.r.t angular) registered against a component
.
Only thing is all those events should be different.
<app-inputs
(event)="getDataFromChild($event)"
(eventTwo)="getDataFromChildTwo($event)"
(event_N)="getDataFromChild_N($event)"></app-inputs>
Upvotes: 1
Reputation: 86740
Yes, You can add events as much as you can until they are different. Same behaviour you can see in many libraries component like primeng.
Different means to say here every event can refer to different event like some is for mouseevent
for keyup
keydown
etc.
Upvotes: 0