JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://github.com/downloads/wycats/handlebars.js/handlebars-1.0.0.beta.6.js"></script>
<script src="https://github.com/downloads/emberjs/ember.js/ember-latest.js"></script>
<script type='text/x-handlebars' data-template-name='application'>
{{view App.TopView}}
{{outlet}}
{{view App.BottomView}}
</script>
<script type='text/x-handlebars' data-template-name='top'>
<p>This is the top view: {{section}}</p>
</script>
<script type='text/x-handlebars' data-template-name='bottom'>
<p>This is the bottom view.</p>
</script>
<script type='text/x-handlebars' data-template-name='frontpage'>
<p>This is the front page.</p>
</script>
JavaScript
var App = Em.Application.create();
App.ApplicationController = Em.Controller.extend();
App.TopController = Em.Controller.extend();
App.BottomController = Em.Controller.extend();
App.FrontpageController = Em.Controller.extend();
App.ApplicationView = Em.View.extend({
templateName: 'application',
classNames: ['application']
});
App.TopView = Em.View.extend({
templateName: 'top',
sectionBinding: 'controller.section',
classNames: ['top'],
classNameBindings: ['section']
});
App.BottomView = Em.View.extend({
templateName: 'bottom',
classNames: ['bottom']
});
App.FrontpageView = Em.View.extend({
templateName: 'frontpage',
classNames: ['frontpage']
});
App.Router = Em.Router.extend({
enableLogging: true,
location: 'history',
root: Em.Route.extend({
goToFrontpage: Em.Route.transitionTo('frontpage'),
index: Em.Route.extend({
route: '/',
redirectsTo: 'frontpage'
}),
frontpage: Em.Route.extend({
route: '/',
connectOutlets: function(router, context) {
router.get('applicationController').connectOutlet({
name: 'frontpage'
});
// THIS DOES WORK:
router.set('applicationController.section', 'index');
}
})
})
});
App.initialize();