Class Ember.ActionHandler
private
Module:
ember
Ember.ActionHandler
is available on some familiar classes including
Ember.Route
, Ember.Component
, and Ember.Controller
.
(Internally the mixin is used by Ember.CoreView
, Ember.ControllerMixin
,
and Ember.Route
and available to the above classes through
inheritance.)
send (actionName, context) public
Module:
ember
Defined in packages/ember-runtime/lib/mixins/action_handler.js:167
- actionName
- String
- The action to trigger
- context
- *
- a context to send with the action
Triggers a named action on the ActionHandler
. Any parameters
supplied after the actionName
string will be passed as arguments
to the action target function.
If the ActionHandler
has its target
property set, actions may
bubble to the target
. Bubbling happens when an actionName
can
not be found in the ActionHandler
's actions
hash or if the
action target function returns true
.
Example
app/routes/welcome.js | |
1 2 3 4 5 6 7 8 9 10 11 12 |
import Route from '@ember/routing/route'; export default Route.extend({ actions: { playTheme() { this.send('playMusic', 'theme.mp3'); }, playMusic(track) { // ... } } }); |