Ember.js 2013-01-09 with v2.1 router

Based on latest version of Ember.js with the new router. (latest ember build from 2013-01-09) Also including latest master of Ember Data (2013-01-09)

by mgrassotti

HTML

<script src="https://github.com/downloads/wycats/handlebars.js/handlebars-1.0.rc.1.js"></script>
<script src="https://gist.github.com/raw/4531968/884821e7ebe981512349d219f42d419d5c45cb77/ember.js"></script>
<script type="text/x-handlebars">
  <header>
    {{#linkTo "index"}}Index{{/linkTo}}
    
    <nav>
      {{#linkTo "about"}}About{{/linkTo}}
      {{#linkTo "favorites"}}Favorites{{/linkTo}}
    </nav>
  </header>

  <h1>{{title}}</h1>
  
  {{outlet}}
</script>

<script type="text/x-handlebars" data-template-name="index">
  Index
</script>

<script type="text/x-handlebars" data-template-name="about-off">
  About
</script>

<script type="text/x-handlebars" data-template-name="favorites">
  Favorites
</script>

JavaScript

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

App.Router.map(function() {
  this.route("about");
  this.route("favorites", { path: "/favs" });
});

App.IndexRoute = Ember.Route.extend({
  setupController: function(controller) {
    // Set the IndexController's `title`
    controller.set('title', "My App");
  }
});

App.IndexView = Ember.View.extend({
  template: Ember.Handlebars.compile('Index template in code'),
//  templateName: 'indexTemplate'
  didInsertElement: function() {
    alert("Hello, Index View");
  }
}); 

App.AboutView = Ember.View.extend({
  template: Ember.Handlebars.compile('About template in code'),  
  didInsertElement: function() {
    alert("Hello, About View");
  }
});

App.AboutRoute = Ember.Route.extend({

	setupController: function(controller) {
		alert("Hello, About");
	}
});