質問

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