Skip to content

Latest commit

 

History

History
54 lines (39 loc) · 1.27 KB

File metadata and controls

54 lines (39 loc) · 1.27 KB

ember/template-no-action

Disallows the use of {{action}} helper.

The {{action}} helper is deprecated in favor of the {{on}} modifier and {{fn}} helper, which provide better performance and clearer intent.

Examples

Examples of incorrect code for this rule:

<template>
  <button {{on "click" (action "save")}}>Save</button>
</template>
<template>
  {{action "doSomething"}}
</template>

Examples of correct code for this rule:

<template>
  <button {{on "click" this.save}}>Save</button>
</template>
<template>
  <button {{on "click" (fn this.save "arg")}}>Save with arg</button>
</template>
<template>
  {{this.action}}
</template>

Migration

  • Replace (action "methodName") with method references or (fn this.methodName)
  • Replace <button onclick={{action ...}}> with <button {{on "click" ...}}>

References