我有两个资源都具有相同的子资源:
App.Router.map(function() {
this.resource('post', function() {
this.resource('comments', function() {
this.route('new');
});
});
this.resource('product', function() {
this.resource('comments', function() {
this.route('new');
});
});
});
Run Code Online (Sandbox Code Playgroud)
问题是,ember路由器只根据当前和父路由构建路由对象的名称,而不是整个层次结构.因此,它会尝试路线都/posts/:id/comments/new和/products/:id/comments/new到App.NewCommentRoute对象.我该怎么做才能解决这个问题?
这篇文章改编自GitHub问题.