Last active
August 6, 2017 00:27
-
-
Save mariechatfield/04e61443dc21e0198425798fe0511b99 to your computer and use it in GitHub Desktop.
Ember Events: onClick HTML Attribute
This file contains 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
export default Ember.Controller.extend({ | |
actions: { | |
handleClick(event) { | |
console.log('This action was fired directly by the browser as part of this DOM event:', event); | |
} | |
} | |
}); |
This file contains 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
<!-- This is what is actually added to the DOM when the template is rendered. --> | |
<div class="onclick-attribute"></div> | |
<!-- | |
This element does have a native event listener attached. | |
You can verify this in your browser's JavaScript console: | |
> document.getElementsByClassName('onclick-attribute')[0].onclick | |
function () { | |
return makeClosureAction(context, targetRef.value(), actionRef.value(), processArgs, debugKey).apply(undefined, arguments); | |
} | |
--> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment