Given the following route;

this.resource('show', { path: '/shows/:show_id' }, function() {
    this.resource('report', {path: '/reports/:report_id'}, function() {
        this.resource('interactions');
    });
});

I would have expected to be able to call;

transitionTo('show.report.interactions', show_model, report_model);

But I am getting a route not found error in my console.

I would be very grateful if someone could someone explain what I am doing wrong here?

有帮助吗?

解决方案

After some more digging (including looking in Ember Inspector, which was showing my original route as valid) I found that if you call App.Router.router.recognizer.names you can see all the routes that transitionTo can call.

Because interactions is a resource I could call it by itself and pass the models in, this will create the route I expected.

The final code then was just;

transitionTo('interactions', show_model, report_model);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top