嵌套网址:路由转换的问题 [英] Nested URLs: issues with route transition
问题描述
this.resource('customer',{path:'/ Customer /:id'});
this.resource('employees',{path:'/ Customer /:id / Employees'});
现在,在Customers /:id(提交操作之后)在DS中创建一个新的Customer实例。存储和一组空的Employee对象也被添加到DS.store中。
问题是从客户转变为员工,员工模板实际上没有被渲染,维护客户模板。最后一个日志消息是尝试过渡到员工。
你能给我一个提示可能是什么问题吗?
由于您的路由器,Employees路由不知道其父路由是什么,虽然您定义了此层次结构中的路径,但您应该使用嵌套路由(资源)。
this.resource('customer',{path:'/ customer /:id'},function(){
this.route('employees',{path:'/ employees'});
});
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?
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'});
});
这篇关于嵌套网址:路由转换的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!