Ember.js Base fiddle

by teddyzeenny

HTML

<script src="https://github.com/downloads/wycats/handlebars.js/handlebars-1.0.0.beta.6.js"></script>
<script src="https://github.com/downloads/emberjs/ember.js/ember-latest.js"></script>

JavaScript

App = Ember.Application.create({
    ready: function () {
        console.log('Ember Application ready');
        this.topCampaignsController = Ember.ArrayController.create({
            content: null
        });
        
        App.TopCampaignsModel.create();
    }
});

App.TopCampaignsModel = Ember.Object.extend({
    data: null,
    
    success: function () {
        this.set('data', [5,10]);
    },

    onDataChange: function () {
        console.log('data property on the object changed');
        App.topCampaignsController.set('content', this.get('data'));
    }.observes('data'),    
    
    init: function () {
        console.log('TopCampaignsModel created');
        this.success();
        console.log(this.get('data'));
    }
});