문제

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