Ember Router Primer

by amindunited

HTML

<script src="http://amindunited.com/lib/js/int/ember.1.pre.jquery.1.8.fix.js"></script>
<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-1.0.pre.js"></script>
<script type="text/x-handlebars" data-template-name="application">
  <h1>Hi Ember</h1>
    <p {{bindAttr class="isSlogan"}}>Ember is: {{slogan}}</p>
</script>

JavaScript

window.App = Ember.Application.create({
    ApplicationView: Ember.View.extend({
        templateName: 'application',
        classNames:['application-view'],
        didInsertElement : function(){
            console.log('did insert:');
            console.log(this.$());
        }
    }),
    ApplicationController: Ember.Controller.extend({
        slogan: "A framework for creating ambitious web applications",
        isSlogan: true
    }),
    ready : function(){
        console.log("created app namespace");
    },
    Router: Ember.Router.extend({
        enableLogging: true,
        root:  Ember.Route.extend({
            index: Ember.Route.extend({
                route : '/'
            })
        })
    })
});
App.initialize();