Skip to content

Latest commit

 

History

History
49 lines (34 loc) · 1.35 KB

File metadata and controls

49 lines (34 loc) · 1.35 KB

ember/template-no-element-event-actions

Disallow using element event actions (e.g., onclick={{action}}) in templates. Use the {{on}} modifier instead.

Rule Details

This rule disallows the use of element event actions in templates.

Examples

Examples of incorrect code for this rule:

<template>
  <button onclick={{this.handleClick}}>Click</button>
</template>
<template>
  <div onmouseenter={{this.handleHover}}>Hover</div>
</template>

Examples of correct code for this rule:

<template>
  <button {{on "click" this.handleClick}}>Click</button>
</template>
<template>
  <div {{on "mouseenter" this.handleHover}}>Hover</div>
</template>

Options

Name Type Default Description
requireActionHelper boolean false When true, only flags events using {{action ...}}; when false, flags any dynamic value on event attributes.

References