Created
March 16, 2018 17:39
-
-
Save mariechatfield/527499b0768dc6c99992c2e12d5385f5 to your computer and use it in GitHub Desktop.
Caption for Chart: How to Attach Event Listeners in Ember
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Header Row: Code Sample, API, Access to Event? | |
Row 1: | |
+ Code Sample: | |
``` | |
didInsertElement() { | |
this.$().on('click', this.handleClick); | |
} | |
``` | |
+ API: Native DOM | |
+ Access to Event? Yes | |
Row 2: | |
+ Code Sample: | |
``` | |
<div onclick={{action "handleClick"}}></div> | |
``` | |
+ API: Native DOM | |
+ Access to Event? Yes | |
Row 3: | |
+ Code Sample: | |
``` | |
<div {{action "handleClick"}}></div> | |
``` | |
+ API: Ember | |
+ Access to Event? No | |
Row 4: | |
+ Code Sample: | |
``` | |
<div {{action "handleClick" on="doubleClick"}}></div> | |
``` | |
+ API: Ember | |
+ Access to Event? No | |
Row 5: | |
+ Code Sample: | |
``` | |
{{some-component click=(action "handleClick")}} | |
``` | |
+ API: Ember | |
+ Access to Event? Yes | |
Row 6: | |
+ Code Sample: | |
``` | |
Component.extend({ | |
click(event) { | |
this.handleClick(event); | |
} | |
}); | |
``` | |
+ API: Ember | |
+ Access to Event? Yes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment