2014-10-20 296 views
0

当我使用没有参数的路由时,我的模板中有正常的路径。但是,当我加入一些“鼻涕虫”,是这样的:在控制台铁路由器和路径

@route "pagesSlug", 
    path: "/page/:_slug" 
    name: "page" 

,并得到错误:

You called Router.path for a route named page but that route doesn't seem to exist. Are you sure you created it? 

没有改变,当我添加/删除名称。 我有空{{pathFor ...在我的模板中,而urlFor太空了。

在这种情况下:

@route "articlesList", 
    path: "/articles" 
    waitOn:()-> 
    Meteor.subscribe 'articles' 

我有HREF = “/篇” - 没问题。

更新:流星0.9.4和铁路由器0.9.4。

+0

其中铁路由器版本您使用的是参数_slug? 0.9.4或1.0.0-pre4? – waitingkuo 2014-10-20 07:23:41

+0

0.9.4。对不起,“最新” – Vladislav 2014-10-20 07:38:50

回答

1

路由功能的第一个参数是路由的名称。您的路线名称为pagesSlug

pathFor帮手获取路径,你也需要通过

{{pathFor "pagesSlug" _slug="xxxx"}} 
+0

我在手册中阅读了这个。但这不起作用。 tempalte {{pathFor'pagesSlug'}}为空 – Vladislav 2014-10-20 08:49:47

+0

我已更新答案 – waitingkuo 2014-10-20 09:08:52