Closed sbley closed 8 years ago
I would suggest the following naming convention for events:
Name events without the prefix 'on'. Name your event handler methods with the prefix 'on' followed by the event name.
/* WRONG */ <my-voter (onVoted)="onVoted($event)"></my-voter>
/* CORRECT */ <my-voter (voted)="onVoted($event)"></my-voter>
Why?: This is to be consistent with built-in events like button clicks:
<button (click)="showDetails()">Show Details</button>
Why?: Angular allows for an alternative syntax on-*. If the event itself was prefixed with 'on' this would result in an on-onEvent binding expression.
on-*
on-onEvent
/* CORRECT */ <my-voter (voted)="onVoted($event)"></my-voter> <my-voter on-voted="onVoted($event)"></my-voter>
This sounds good to me. Do you want to open a PR?
I would suggest the following naming convention for events:
Name events without the prefix 'on'. Name your event handler methods with the prefix 'on' followed by the event name.
Why?: This is to be consistent with built-in events like button clicks:
Why?: Angular allows for an alternative syntax
on-*
. If the event itself was prefixed with 'on' this would result in anon-onEvent
binding expression.