Nested URLs: issues with route transition

三世轮回 提交于 2019-12-13 05:01:31

问题


I am currently struggling to get on board with Ember.js and I bumped into an issue with my current routes design, they have nesting URLs, however there are no nesting templates, so their configuration looks like this:

 this.resource('customer', { path: '/Customer/:id' });
 this.resource('employees', { path: '/Customer/:id/Employees' });

Now, at Customers/:id (after submit action) a new Customer instance is created in DS.store and a set of empty Employee objects are added, as well, into the DS.store.

The problem is transitioning from 'customer' to 'employees', the 'employees' template is not actually rendered, 'customer' template is maintained. The last log message is "Attempting transitioning to employees'.

Could you please give me a hint what might be the problem?


回答1:


Because of your router, Employees route does not know what its parent route is. Although you defined the path in this hierarchy, you should be using nested routes (resources).

 this.resource('customer', { path: '/customer/:id' }, function() {
    this.route('employees', {path: '/employees'});
 });


来源:https://stackoverflow.com/questions/26232251/nested-urls-issues-with-route-transition

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