Google News
logo
Aurelia - Interview Questions
Explain Cheat Sheet "delegate" and "trigger" in Aurelia.
Use on any native or custom DOM event. (Do not include the "on" prefix in the event name.)
 
* .trigger : Attaches an event handler directly to the element. When the event fires, the expression will be invoked.

* .delegate : Attaches a single event handler to the document (or nearest shadow DOM boundary) which handles all events of the specified type, properly dispatching them back to their original targets for invocation of the associated expression.
 
Event Binding Example :
<template>
    <button click.trigger="save()">Save</button>
    <button click.delegate="save($event)">Save</button>
</template>
Advertisement