Ember.js 余烬路由和尝试添加新路由无效

Ember.js 余烬路由和尝试添加新路由无效,ember.js,Ember.js,我刚开始使用Ember,但有一个名为posts.images的路径出现问题 在我的路由器中,我有: this.resource('posts', function(){ this.resource('images', { path: ':post_id' }); this.resource('newpost', { path: 'new' }); this.resource('post', { path: ':post_id' }); }); 我的路线是: Hex.Po

我刚开始使用Ember,但有一个名为posts.images的路径出现问题

在我的路由器中,我有:

this.resource('posts', function(){
    this.resource('images', { path: ':post_id' });
    this.resource('newpost', { path: 'new' });
    this.resource('post', { path: ':post_id' });
});
我的路线是:

Hex.PostImagesRoute = Ember.Route.extend({  // same with Hex.PostsImagesRoute
    model: function(params) {
        console.log('alert postimages');
        return Hex.Post.findById(params.post_id);
    }
});
在我的模板中,我有:

{{#link-to 'posts.images' id}}images{{/link-to}}
但我得到了以下错误:

Assertion failed: The attempt to link-to route 'posts.images.index' failed. The router did not find 'posts.images.index' in its possible routes: 'loading', 'e
我读过这本书,但不确定我做错了什么。任何帮助都将不胜感激

thx向下滚动一点:

注意:如果使用此.resource定义资源,并且未提供函数,则隐式resource.index路由未创建

向下滚动一点:

注意:如果使用此.resource定义资源,并且未提供函数,则隐式resource.index路由未创建

向下滚动一点:

注意:如果使用此.resource定义资源,并且未提供函数,则隐式resource.index路由未创建

向下滚动一点:

注意:如果使用此.resource定义资源,并且未提供函数,则隐式resource.index路由未创建


thx,文件上的措辞不太好。您能告诉我我做错了什么吗?当然,
posts.index
是(隐式)创建的,因为您已将函数传递给路由器中的post资源。在这个函数中,您已经定义了子路由。为了隐式创建
posts.images.index
路由,您必须向images资源传递一个函数。类似这样:
this.resource('images',{path:':post_id'},function(){/…})这有点傻,因为函数本身可以保留为空。你刚刚保存了我的好友。thx,文档上的措辞不是很好。您能告诉我我做错了什么吗?当然,
posts.index
是(隐式)创建的,因为您已将函数传递给路由器中的post资源。在这个函数中,您已经定义了子路由。为了隐式创建
posts.images.index
路由,您必须向images资源传递一个函数。类似这样:
this.resource('images',{path:':post_id'},function(){/…})这有点傻,因为函数本身可以保留为空。你刚刚保存了我的好友。thx,文档上的措辞不是很好。您能告诉我我做错了什么吗?当然,
posts.index
是(隐式)创建的,因为您已将函数传递给路由器中的post资源。在这个函数中,您已经定义了子路由。为了隐式创建
posts.images.index
路由,您必须向images资源传递一个函数。类似这样:
this.resource('images',{path:':post_id'},function(){/…})这有点傻,因为函数本身可以保留为空。你刚刚保存了我的好友。thx,文档上的措辞不是很好。您能告诉我我做错了什么吗?当然,
posts.index
是(隐式)创建的,因为您已将函数传递给路由器中的post资源。在这个函数中,您已经定义了子路由。为了隐式创建
posts.images.index
路由,您必须向images资源传递一个函数。类似这样:
this.resource('images',{path:':post_id'},function(){/…})这有点傻,因为函数本身可以留空..你刚刚救了我的朋友。