Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mariechatfield/527499b0768dc6c99992c2e12d5385f5 to your computer and use it in GitHub Desktop.
Caption for Chart: How to Attach Event Listeners in Ember
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