Skip to content

Support onbubble-event as alternative to (^event) #3448

Closed

Description

@manfredsteyer

Hi,

I've talked to Victor and we think that we need an alternative syntax for binding to bubble-events.

Currently there is on-event="x()" as an alternative to (event)="x()" but no alternative for (^event)="x()".

Wishes,
Manfred

p. s.: perhaps on-bubble-event="x()" would be a good alternative ...

Activity

  1. pkozlowski-opensource commented on Aug 3, 2015

    @pkozlowski-opensource
    Member

    @manfredsteyer this is probably (?) not what you are looking for, but on-^event="x()" works today. Don't see much problem (apart from introducing yet-another-way-of-doing-things) with adding on-bubble-event="x()"

  2. PatrickJS commented on Aug 3, 2015

    @PatrickJS
    Contributor

    The idea for the alternative syntax is legacy html and user familiarity. For example, we're able to create components/directives that work both in angular 1 and angular 2 following the same interface. This is due to the fact that angular 1 didn't enforce any conventions (since no one knew what the best practices were for component/directives 6 years ago). So we can actually take advantage of this today
    (I gave a subtle nod to a migration technique during ng-vegas)

    ng1 https://github.com/gdi2290/ng-vegas-angular2-d3/blob/master/angular1/app.js#L10
    ng2 https://github.com/gdi2290/ng-vegas-angular2-d3/blob/master/app.ts#L60

    essentially we can create a directive that works in both ng1 and ng2 with this example

    <bar-graph
      bind-data="graphData"
      width="500"
      height="130">
    </bar-graph>

    Notice how we're using the alternative syntax but we can do this for angular 1 today using the alias
    scope: { data: '=bindData' }. We create a directive for each event already in angular 1 (legacy) so it does make sense to continue down that path. Doing this allows you to delete half your code (ng2 means twice as good since it's half the code?) when switching to angular 2 (now that we know what the best practices are)

    github-tipe-logo

  3. mhevery commented on Aug 6, 2015

    @mhevery
    Contributor

    This should be onbubble-eventsame as (^event)

  4. changed the title [-]alternative syntax for binding to bubble-events (^event)[/-] [+]Support `onbubble-event` as alternative to `(^event)`[/+] on Aug 6, 2015
  5. added 2 commits that reference this issue on Aug 13, 2015
    4c290ac
    2f8c6ee
  6. angular-automatic-lock-bot commented on Sep 13, 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.

  7. locked and limited conversation to collaborators on Sep 13, 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

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions