Skip to content

Instantly share code, notes, and snippets.

@kkenan
Created February 26, 2016 16:01
Show Gist options
  • Save kkenan/f5fc346472cde8242cac to your computer and use it in GitHub Desktop.
Save kkenan/f5fc346472cde8242cac to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
items: Ember.computed(function() {
var result = [];
for(var i = 0; i < 100; i++) {
result.push({
title: 'Hello world ' + i
});
}
return result;
}),
actions: {
addItem: function() {
this.get('items').addObject({
title: 'New object'
});
}
}
});
<button {{action 'addItem'}}>Add item</button>
{{#ui-table items=items as |item|}}
<li>{{item.title}}</li>
{{/ui-table}}
{
"version": "0.6.0",
"EmberENV": {
"FEATURES": {}
},
"options": {
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.13.6/ember.debug.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.13.6/ember-template-compiler.js"
}
}
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'ul'
});
{{#each items as |item|}}
{{yield item}}
{{/each}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment