Skip to content

Instantly share code, notes, and snippets.

@k-fish
Created June 23, 2016 17:42
Show Gist options
  • Save k-fish/de00a3168636b160f9f5ed7b081f4d2c to your computer and use it in GitHub Desktop.
Save k-fish/de00a3168636b160f9f5ed7b081f4d2c to your computer and use it in GitHub Desktop.
Parent child components
import Ember from 'ember';
export default Ember.Component.extend({
clickFunction: Ember.on('click', function() {
window.alert('component clicked');
}),
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
actions: {
clickAction: function(event) {
window.alert('inner');
return false;
}
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
{{#my-component}}
<div style="background:red; width : 200px;">
<a href="#" style="display:block; background-color: green; width: 100px; z-index:999" onclick={{action 'clickAction'}}>Some link</a>
</div>
{{/my-component}}
<br>
<br>
{
"version": "0.9.3",
"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.6.0",
"ember-data": "2.6.1",
"ember-template-compiler": "2.6.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment