1

I have my emberjs code in the following jsbin,

http://emberjs.jsbin.com/rewumojixe

I am trying to have "search" resource nested inside my "cars" resource, as I want the route to be cars/search . I have used renderTemplate to load the search resource in the application outlet to replace the cars template rendered.

App.SearchRoute = Ember.Route.extend({
    renderTemplate: function () {
        this.render('search', { into: 'application' });
    }
});

This works fine except that on clicking back button on search route is loading a empty cars route.This happens only when the above renderTemplate code is added to the SearchRoute.

msounthar
  • 343
  • 4
  • 8

1 Answers1

1

If you don't want routes nested, don't nest them.

App.Router.map(function() {
    this.resource('home',   { path: '/' });
    this.resource('cars',   { path: '/cars' });
    this.resource('search', { path: '/cars/search' });
});

Demo:

Andrey Mikhaylov - lolmaus
  • 23,107
  • 6
  • 84
  • 133
  • 1
    Thanks, I also found this useful http://stackoverflow.com/questions/15163869/nested-routes-rendering-into-same-template-outlet-breaks-on-browser-back-button – msounthar Feb 17 '15 at 03:58