Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Latest commit

 

History

History
33 lines (23 loc) · 838 Bytes

README.md

File metadata and controls

33 lines (23 loc) · 838 Bytes

DEPRECATED

Ember Bind Helper

CircleCI

This addon provides a bind helper to bind a function to a context.

Installation

ember install ember-bind-helper

Using bind

Let's say we want to call a method of an object when we click a function. We might think of doing the following:

<button onclick={{action myObject.myMethod}}>
  My Button
</button>

Sadly, this might not work as expected, given that the context would be the controller (twiddle). To solve this, you can use the bind helper:

<button onclick={{action (bind myObject.myMethod myObject)}}>
  My Button
</button>