ember install ember-events-modifier
The addon provides an events
service which can be used to facilitate events throughout your application. You can use
the service directly, without using the modifiers
, described below.
import Controller from "@ember/controller";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
export default class MyController extends Controller {
@service events;
@action clickedBook(book) {
this.events.trigger(`book:active:${book.id}`, book);
}
}
The on-event
modifier allows you to register a handler for specific events.
Your action handler will be passed arguments that are provided when the action is triggered.
Note that the handler is automatically registered and removed on insertion/removal, respectively.
You can also handle multiple events with one declaration:
The trigger-event
modifier allows you to trigger an event when the element is inserted.
- Ember.js v3.28 or above
- Ember CLI v3.28 or above
- Node.js v14 or above
See the Contributing guide for details.
This project is licensed under the MIT License.