Ember JS transition to nested routes where all routes are dynamic segments from a view

╄→гoц情女王★ 提交于 2019-12-04 01:21:19

Two things to note:

First, instead of

this.get('controller.target.router').transitionTo('image', queue, task, image);

Use:

this.get('controller').transitionToRoute('image.index', queue, task, image);

This might not change the behaviour, but it's more Ember idiomatic.

The second thing is the following:

Internal transitions will not trigger the model hook on the route, because Ember assumes you are passing the model along with the transition, so no need to call the model hook since you already passed the model.

That is why your breakpoint doesn't get triggered, the find isn't being called (as it shouldn't).

I don't have enough information to find your issue but if I were to guess from the fact that a page refresh works and an internal transition doesn't is that there is an inconsistency between the objects passed to transitionTo and between what is returned from the model hook.

You should pass the exact object to transitionTo as the ones that would have been returned by themodel hook.

If you are doing:

this.get('controller').transitionToRoute('image.index', queue, task, image);

and it's not working, something is probably wrong with either queue, task, or image models you are passing.

So this:

   var task = //assume this value exists;
   var queue = //assume this value exists;
   var image = //assume this value exists;

is not very helpful because it could be where the problem is.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!