Ember Latest
The latest build of Ember.
HTML
<script src="http://builds.emberjs.com/handlebars-1.0.0.js"></script>
<script src="http://builds.emberjs.com/ember-latest.min.js"></script>
<script type="text/x-handlebars" data-template-name="application">
<h1>ember-latest jsfiddle</h1>
<p>
{{link-to 'index' 'index'}}
{{link-to 'first room' 'room' 1}}
{{link-to 'second room' 'room' 2}}
</p>
Current URL: {{currentUrl}}
{{#foo-bar}}Current route path: {{input value=currentPath}}{{/foo-bar}}
</script>
<script type="text/x-handlebars" data-template-name="components/foo-bar">
{{yield}}
</script>
CSS
h1 { font-size: 1.6em; padding-bottom: 10px; }
h2 { font-size: 1.4em; }
ul { padding: 15px; font-size: 1.4em; color: green; }
JavaScript
App = Ember.Application.create({});
App.Router.map(function() {
this.route('index', { path: '/' });
this.route('room', { path: '/room/:room_id' });
});
App.RoomRoute = Ember.Route.extend({
model: function () {
return 'whatever';
}
});
App.ApplicationController = Ember.Controller.extend({
currentUrl: null,
onPathChanged: Ember.observer('target.url', function() {
Ember.run.next(this, function() {
this.set('currentUrl', window.location.href);
});
})
});