Skip to content

Instantly share code, notes, and snippets.

@jmimi
Created July 13, 2016 00:20
Show Gist options
  • Save jmimi/85a4489a43d77e9779b14e368a08bc6a to your computer and use it in GitHub Desktop.
Save jmimi/85a4489a43d77e9779b14e368a08bc6a to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'td' ,
click(){
this.sendAction('clicked');
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
myArr: [{val: 'one', checked: false}, {val: 'two', checked: false}, {val: 'three', checked: false}],
actions: {
rowClicked(){
//do something
Ember.Logger.debug('row');
},
checkClicked(){
Ember.Logger.debug('checkbox');
}
}
});
<h1>Welcome to {{appName}}</h1>
<table class="table table-hover">
<thead>
<th></th>
<th>Things</th>
<th>Stuff</th>
<th></th>
</thead>
<tbody>
{{#each myArr as |item|}}
<tr style="cursor: pointer;">
<td>{{input type="checkbox" checked=item.checked}}</td>
{{custom-td value=item.val clicked=(action 'rowClicked')}}
{{custom-td value="Something" clicked=(action 'rowClicked')}}
</tr>
{{/each}}
</tbody>
</table>
{{outlet}}
<br>
<br>
{
"version": "0.10.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.6.0",
"ember-data": "2.6.1",
"ember-template-compiler": "2.6.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment