Hello Ember.js (world), goodbye sanity!?

Every Ember.js app needs to have:

window.App = Ember.Application.create();

where App is the name of your application. You could call it Whatever, but it should probably have a name that relates to the app you’re building. It has to start with a capital letter tho, in order for bindings (huh?, more on this later) to find it.

Then to start your app add:

App.initialize();

Congrats! You have created your first Ember-app. Totally useless, but hey hang on!

A bonus part

Like jQuery, Ember.js has a ready-function that fires when the DOM is ready. Add this to your Ember.Application.create();

ready: function(){
  alert("Hello Ember.js (world), goodbye sanity!?");
}

Now our finished application looks lite this:

window.App = Ember.Application.create({
  ready: function(){
    alert("Hello Ember.js (world), goodbye sanity!?");
  }
});
App.initialize();

One Reply to “Hello Ember.js (world), goodbye sanity!?”

Comments are closed.