Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Replace parent view from child route

Tags:

ember.js

Following my question here Nested routes in Ember I would like to replace the view rendered from /settings/users/ with the view rendered by /settings/users/1.

My routes are defined as:

Router.map(function() {
    this.route('login');
    this.resource('settings', { path: 'settings/:settings_id' }, function() {
        this.route('overview');
        this.route('users', function() {
            this.route('user', { path: ':user_id' });
        });
    });
});

My user.hbs template will render when users.hbs contains {{outlet}}. I want the user.hbs to render in place of users.hbs not within it.

like image 958
Sam Avatar asked Jan 02 '15 06:01

Sam


1 Answers

Change your users template to just an outlet

{{outlet}}

And put the stuff from your users template into your users/index template, then it will only show up when you're on the users route, and when you go any deeper, it won't show the index route.

Cool stuff in the users index template

Example: http://emberjs.jsbin.com/jacebeyira/1/edit?html,js,output

like image 160
Kingpin2k Avatar answered Sep 22 '22 14:09

Kingpin2k