Minimalistic starting point for Ember.js
HTML
<script src="https://github.com/downloads/emberjs/ember.js/ember-0.9.5.js"></script>
<script type="text/x-handlebars" >
{{view App.UserTextField}}
{{#each App.recentUsersArray.reverse tagName="ul"}}
<li>{{this}}</li>
{{/each}}
</script>
JavaScript
App = Ember.Application.create();
App.UserTextField = Ember.TextField.extend({
insertNewline: function(){
var term = this.get('value');
App.recentUsersArray.pushObject(term);
}
});
App.recentUsersArray = Em.ArrayController.create({
content: ['noelle', 'evan', 'mason'],
reverse: function(){
return this.get('content').toArray().reverse();
}.property('content.@each').cacheable(),
});