Skip to content

Instantly share code, notes, and snippets.

@code0100fun
Last active May 23, 2016 08:35
Show Gist options
  • Select an option

  • Save code0100fun/fcba6c7de120010b155625a7d6767821 to your computer and use it in GitHub Desktop.

Select an option

Save code0100fun/fcba6c7de120010b155625a7d6767821 to your computer and use it in GitHub Desktop.
Actions Part 2
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Weekend',
actions: {
controllerAction() {
alert('in the application controller');
},
controller2RouteAction() {
alert('in the application controller');
this.send('routeAction');
}
}
});
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
routeAction() {
alert('in the application route');
},
controller2RouteAction() {
alert('in the application route');
}
}
});
<h1>Welcome to {{appName}}</h1>
<button {{action "controllerAction"}}>
Controller Action
</button>
<button {{action "routeAction"}}>
Route Action
</button>
<button {{action "controller2RouteAction"}}>
Route Bubbling
</button>
{
"version": "0.8.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.5.1",
"ember-data": "2.5.2",
"ember-template-compiler": "2.5.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment