Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
New Twiddle
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'ul',
display: Ember.computed('data.[]', function() {
return this.get('data').slice(-1)[0];
}),
nested: Ember.computed('data.[]', function() {
return this.get('data').slice(0, -1);
}),
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
reversedList: [{id: 21}, {id: 16}, {id: 1}],
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
{{app-activity-tree data=reversedList}}
<br>
<br>
<li>
{{display.id}}
{{#if nested}}
{{app-activity-tree data=nested}}
{{/if}}
</li>
{
"version": "0.10.4",
"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.7.0",
"ember-data": "2.7.0",
"ember-template-compiler": "2.7.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment