Ember basic app construction
includes delayed init and root element assignment
by amindunited
HTML
<script src="http://cloud.github.com/downloads/wycats/handlebars.js/handlebars-1.0.0.beta.6.js"></script>
<script src="http://cloud.github.com/downloads/emberjs/ember.js/ember-latest.js"></script>
<div id="appWrap">
</div>
JavaScript
$(function(){
window.basicApp = Ember.Application.create({
autoinit:false,//If the app auto inits the dom/data might not be ready for it (we'll call it later ourselves)
rootElement:'#appWrap'//We want to lock the app down to a specific dom element to prevent conflict with old HTML (default is 'body')
});
basicApp.ApplicationController = Em.Controller.extend();
basicApp.ApplicationView = Em.View.extend({});
basicApp.router = Em.Router.create({
enableLogging : true,
root: Em.Route.extend({
index: Em.Route.extend({
route:'/',
enter:function(){
console.log("entered root")
}
})
})
});
basicApp.initialize(basicApp.router);
})