Ember Route hooks

Actions may bubble up the route tree, but do route hooks?

by pjmorse

HTML

<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0/handlebars.min.js"></script>
<script src="http://builds.emberjs.com/canary/ember.js"></script>
<script type="text/x-handlebars">
    <h1>Running the routes</h1>
    <div class='links'>
        <ul>
            <li>{{#link-to 'mainlink'}}Home{{/link-to}}</li>
            <li>{{#link-to 'orders'}}Orders{{/link-to}}</li>
        </ul>
    </div>
    <div class='content'>{{outlet}}</div>
</script>

<script type='text/x-handlebars' data-template-name='mainlink'>
    {{outlet}}
</script>

<script type='text/x-handlebars' data-template-name='mainlink/index'>
    <h2>Start</h2>
</script>

<script type='text/x-handlebars' data-template-name='orders'>
    {{outlet}}
</script>

<script type='text/x-handlebars' data-template-name='orders/index'>
    <h2>Orders</h2>
    <p>Expected at order index route (/orders/)</p>
</script>

CSS

a {color:#666}
a.active {color:#FF0000}
.links {padding: 10px;background-color:#CCC;}
.content {padding: 10px;}

CoffeeScript

window.App = Ember.Application.create()

App.Router.map ->
    @resource 'mainlink', path: '/', ->
        @resource 'orders', path: '/orders', ->

App.ApplicationRoute = Ember.Route.extend
    beforeModel: ->
        console.log "This is ApplicationRoute"

App.OrdersRoute = Ember.Route.extend
    model: ->
        console.log "This is in OrdersRoute"