Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data context incorrect for parent route. #14

Open
ddanna opened this issue Dec 29, 2015 · 1 comment
Open

Data context incorrect for parent route. #14

ddanna opened this issue Dec 29, 2015 · 1 comment

Comments

@ddanna
Copy link

ddanna commented Dec 29, 2015

If I'm using a route with two titles defined by a function, the data context is incorrect for the parent route, when navigating to the child route.

Example:

this.route('/projects/:_projectId/', {
    name: 'project',
    data: function(){
        /*get project from projects collection*/
    },
    title: function(){
        return this.data().projectTitle;
    }
});

this.route('/projects/:_projectId/:_taskId', {
    name: 'task',
    data: function(){
        /*get task from tasks collection*/
    },
    title: function(){
        return this.data().taskTitle;
    },
    parent: 'project'
});

When navigating to /projects/projectId the title of the project title is correctly displayed by the breadcrumb.

When navigating to /projects/projectId/taskId, I only see the title of the task, when I'd expect to see Project Title / Task Title

@ddanna
Copy link
Author

ddanna commented Dec 29, 2015

My current work around is to not use the this.data() method and instead use a collection lookup in the title function.

Example:

this.route('/projects/:_projectId/', {
    name: 'project',
    data: function(){
        return Projects.findOne({_id: this.params.taskId});
    },
    title: function(){
        /*return this.data().projectTitle;*/
        return Projects.findOne({_id: this.params.taskId}).projectTitle;
    }
});

this.route('/projects/:_projectId/:_taskId', {
    name: 'task',
    data: function(){
        return Tasks.findOne({_id: this.params.taskId});
    },
    title: function(){
        /*return this.data().taskTitle;*/
        return Tasks.findOne({_id: this.params.taskId}).taskTitle;
    },
    parent: 'project'
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant