Skip to content

Instantly share code, notes, and snippets.

@kkenan
Last active June 14, 2016 23:54
Show Gist options
  • Save kkenan/2b5a55fadb16ddb42fb4d92d5c97480b to your computer and use it in GitHub Desktop.
Save kkenan/2b5a55fadb16ddb42fb4d92d5c97480b to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Component.extend({
init: function() {
this._super.apply(this, arguments);
var arr = [];
for (var i = 0; i < 1000; i++) {
arr.push(i);
}
this.set('someLargeArray', arr);
},
didInsertElement: function() {
this.set('parentTest', this);
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
actions: {
show: function() {
if (this.get('isShown')) {
this.set('components', []);
return;
}
var t = [];
for (var i =0; i < 1000; i++) {
t.push(i);
}
this.set('components', t);
this.set('isShown', true);
}
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<button {{action 'show'}}>Show</button>
{{#each components as |com|}}
{{my-component}}
{{/each}}
{
"version": "0.9.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": "1.13.8",
"ember-data": "2.6.0",
"ember-template-compiler": "1.13.8"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment