Simple S.O. answer
http://stackoverflow.com/questions/9636788/ember-js-pushobject-not-inserting-object-in-an-arraycontroller
HTML
<script src="https://github.com/downloads/emberjs/ember.js/ember-latest.js"></script>
<script src="https://github.com/downloads/emberjs/data/ember-data-latest.js"></script>
<script type="text/x-handlebars">
</script>
JavaScript
window.App = App = Ember.Application.create();
/**************************
* Models
**************************/
/**************************
* Views
**************************/
/**************************
* Controllers
**************************/
App.testController = Ember.ArrayController.extend({
content: null,
init: function() {
this._super();
this.set('content', Ember.A());
},
addContent: function() {
var obj = Ember.Object.create({a:1, b:2});
this.pushObject(obj);
console.log(this.get('length'));
}
});
/**************************
* App Logic
**************************/
$(function() {
ctr = App.testController.create();
ctr.addContent();
});