{{fn}}

Partially applies arguments to a function for use as a callback.

Since Ember 4/5 (Octane) Spec ↗

Syntax

{{fn this.handler arg1 arg2}}

Returns

function — A new function with the leading args bound.

Examples

{{#each @items as |item|}}
  <button
    type="button"
    {{on "click" (fn this.remove item)}}
  >
    Remove {{item.name}}
  </button>
{{/each}}

Notes

{{fn}} pre-binds arguments without invoking the function. Event handler args are appended after the bound ones (e.g. the DOM event). The target method should be an @action.