rksh
rksh

Reputation: 4050

Ember Link-to not rendering template

Here are the routers and the routes of the ember project, in the template there is a link called {{#link-to 'submit'}} that will display the submit template within the index template.

This works fine when I type the URL on the address bar (address#/submit) but this doesn't work when licking the {{#link-to 'submit'}}Submit{{/link-to}}.

When clicking the link the URL changes to (adress#/submit) but the submit template is not rendered it just shows the normal index template. No errors on the console as well. What should I change?

Thanks

App.Router.map(function() {    
this.resource("submit", { path: '/submit' });
});


App.SubmitRoute = Ember.Route.extend({
        renderTemplate: function() {

        this.render('submit', {
            outlet : 'submit' ,
            into  : 'index'
        });
    }
});

Upvotes: 1

Views: 1281

Answers (1)

rshives
rshives

Reputation: 56

I believe that you need to pass in the context in the link-to helper.

{{#link-to 'submit' this}}Submit{{/link-to}}

Also, just some advice, Resources are associated with nouns and Routes with verbs. So I'd change your router to use this.Route("submit"); If the path is the same as the template the route will be implicitly generated.

Upvotes: 1

Related Questions