Route hierarchy / activation

We have a scenario along these lines:

Quote —>Create

So route names quote and quote.create.

The issue is that we need to render the templates into the main outlet. So in our main route (that all other are inherited from) we have this:

renderTemplate: function() { this.render({ into: 'application' }); }

When I navigate to quote it renders the quote view. From there I navigate to quote.create and it renders the create view. However, going back to quote from quote.create renders nothing.

How can I get around this?

EDIT

When I go back to the \quote url route ‘quote.index’ is sought. Since it is defined ‘automagically’ nothing happens. When I define the route explicitly ember tries to find the quote.index template and view and these do not exist.

EDIT 2

A workaround I tried is to have this:

App.QuoteIndex{Route|Controller|View} = App.Quote{Route|Controller|View}.extend()

1 Like

Hi @ebenroux. Could you manage to understand what has to be done to get the “back” button re-rendering the previous route in the ‘application’ template? Is it a bug?

I may have misunderstood exactly what you want but I think the following should do it

// router.js
Router.map(function() {
    this.resource('quote', function(){
        this.route("create");
    });
});

// templates/application.hbs
{{outlet}}

// templates/quote/index.hbs
<h1>Quote</h1>
{{#link-to 'quote.create'}}
	Create
{{/link-to}}

// templates/quote/create.hbs
<h1>Create quote</h1>
{{#link-to 'quote.index'}}
	Back
{{/link-to}}

Hello,

Here is my SO question with the answer that I accepted: ember.js - Ember js version 1: Route hierarchy / activation - Stack Overflow

Regards, Eben