Skip to content

Event Properties Consistency #4207

Closed
Closed

Description

@tbragaf

Hi everyone!

Properties and Events have different alias behaviour.

If I want to alias a property with hyphens I use:

properties: ['selectedValue: selected-value'],

But If I want to alias an event with hypens:

events: ['valueUpdate: selected-value'] // this won't work... 
//events: ['valueUpdate: selectedValue'] // this works
And then I can use (selected-value)="event"

Working plnkr: http://plnkr.co/edit/TnUqxetDhbgcO1ZEX63U?p=preview

Best regards,
Tiago Braga

Activity

  1. mhevery commented on Sep 29, 2015

    @mhevery
    Contributor

    This works as intended, even thought it is confusing. That is because <div (selected-value)="..."> binds to what event? Because we don't have casing in HTML, we have to assume that it binds to selectedValue event since that is the convention we use for converting skewer-case to camelCase. Therefore ['valueUpdate: selectedValue'] is correct.

  2. tbragaf commented on Sep 29, 2015

    @tbragaf
    Author

    I understand it is correct. It is about consistency.
    I just think that an alias to a property should be similar to an event.
    An alias works as an outside way to use a property.

    In property aliases we use the hyphens and works.
    Not the case with events. We need the alias to be camel case.

    As I understood:

    <property/event> : <alias to use from the outside>
  3. angular-automatic-lock-bot commented on Sep 7, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  4. locked and limited conversation to collaborators on Sep 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions