Ember.js 2013-01-10 with v2.1 router
Based on latest version of Ember.js with the new router. (latest ember build from 2013-01-10) Also including latest master of Ember Data (2013-01-09)
by darthdeus
HTML
<script src="https://github.com/downloads/wycats/handlebars.js/handlebars-1.0.rc.1.js"></script>
<script src="https://gist.github.com/raw/711e594f5c3b8bcbb39f/4850b745fa3e0009d31d147add18a516d446d2a4/ember-data-latest-20130109.js"></script>
<script src="https://gist.github.com/raw/4520982/c707b0a86a7e3665cd7722aa7013f37d8040f202/ember-latest-20130113.js"></script>
<script type="text/x-handlebars" data-template-name="application">
<h1>Hello from Ember.js</h1>
{{outlet}}
</script>
<script type="text/x-handlebars" data-template-name="home">
Welcome home
<a {{action foo target="controller"}} href="#">foo controller</a>
<a {{action foo target="router"}} href="#">foo router</a>
</script>
JavaScript
App = Ember.Application.create();
App.ApplicationController = Ember.Controller.extend();
App.ApplicationView = Ember.View.extend({
templateName: 'application'
});
App.Router.map(function(match) {
match("/").to("home");
});
App.Store = DS.Store.extend({
revision: 11,
adapter: "DS.FixtureAdapter"
});
App.HomeController = Ember.Controller.extend({
foo: function() {
console.log("router store: " + this.get("store").toString());
}
});
App.HomeRoute = Ember.Route.extend({
events: {
foo: function() {
console.log("router store: " + this.get("store").toString());
}
}
});