Last active
October 7, 2015 15:28
-
-
Save Kilowhisky/f5b3a5f20af5a825e684 to your computer and use it in GitHub Desktop.
New Twiddle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName:'Ember Twiddle' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
filterStartRange: 0, | |
filterStopRange: 5000, | |
filterRecomputed: 0, | |
filtered: Ember.computed.filter('model', function(item) { | |
this.incrementProperty('filterRecomputed'); | |
return item.id > this.get('filterStartRange') && item.id < this.get('filterStopRange'); | |
}).property('model','filterStartRange','filterStopRange') | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
model(){ | |
var arr = []; | |
for(var i = 0; i < 300; i++){ | |
arr.pushObject({ | |
id: i, | |
text: `Index ${i}.` | |
}); | |
} | |
return arr; | |
}, | |
actions: { | |
addItem: function(){ | |
var model = this.modelFor(this.routeName); | |
var lastItem = model.get('lastObject'); | |
var newIndex = lastItem.id + 1; | |
model.pushObject({ | |
id: newIndex, | |
text: 'Index' + newIndex | |
}); | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.4.11", | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "http://builds.emberjs.com/release/ember.debug.js", | |
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/1.13.11/ember-data.js", | |
"ember-template-compiler": "http://builds.emberjs.com/release/ember-template-compiler.js" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment