Linkto and nested resources


#1

Hi, I’am new to ember and have a problem with nested resources and links. In my app I have a profile page with with a link and map section.

in the info part if I do (a link to another profile)

{{#link-to 'profile' venn.profile_id}}

when I click the link the info part is not updated. I understand why this happens, but how do I force ember to refresh nested resources?

Router.js

Router.map(function() {

this.resource('persons', { path: '/search'}, function() {
    this.resource('person', { path: ':person_id' });
});


this.resource('profiles', { path : '/profiles'}, function() {
    
    this.resource('profile', { path: ':profile_id' }, function() {
        this.resource('info');
        this.resource('map');
    });
});

My profile.js route

import person from ‘…/utils/person’;

export default Ember.Route.extend({

model: function(params) {
    return person(params.profile_id);
},
setupController: function (controller, model) {
    controller.set('model', model);
},
afterModel: function() {
    this.transitionTo('info');
} });

#2

Fixed it, used the wrong property.


#3

I think, since your profile resource uses sub routes, you’ll have to use the index route of the profile resource.

{{#link-to 'profile.index' venn.profile_id}}

or

{{#link-to 'profile.index' venn.profile}}