Coffeescript 流星路径助手没有返回任何东西

Coffeescript 流星路径助手没有返回任何东西,coffeescript,meteor,Coffeescript,Meteor,为了学习流星,我跟随萨夏·格雷夫的书《发现流星》当前源代码反映在此处-> 现在,我正在尝试向post_项添加一个“discussion”链接,它应该呈现单个post_项 <template name="postItem"> <div class="post"> <div class="post-content"> <h3><a href="{{url}}">{{title}}</a><span&

为了学习流星,我跟随萨夏·格雷夫的书《发现流星》当前源代码反映在此处->

现在,我正在尝试向post_项添加一个“discussion”链接,它应该呈现单个post_项

<template name="postItem">
  <div class="post">
    <div class="post-content">
      <h3><a href="{{url}}">{{title}}</a><span>{{domain}}</span></h3>
    </div>
    <a href="{{postPagePath title}}" class="discuss btn">Discuss</a>
  </div>
</template>
当前,如果我在浏览器中键入

localhost:3000/posts/foobarid
它呈现相应的帖子

但是当我添加{{postPagePath title}}时,讨论按钮甚至没有显示href属性。我想这是因为它没有呈现任何东西


这里对Meteor非常陌生,任何指导都非常感谢

这里有几点需要注意:

首先,您在教程中使用的路由器包Meteor router已被弃用,取而代之的是Meteor的标准路由包Iron router。你可以在Meteor Router github页面上看到这一点,你可以找到Iron路由器规范。我怀疑你可能也在使用《发现流星》的旧版本,因为它现在详细介绍了铁路由器。如果有可能的话,我会设法弄到这本书的一个版本,涵盖铁路由器,因为这将是可预见的未来的标准

第二,href=”“属性没有显示是正确的,因为它没有呈现任何内容。具体来说,在Meteor 0.8+中,如果属性的值返回null、undefined或false,则属性本身将被删除


最后,虽然我对Meteor Router的详细信息了解不多,但在快速检查中,似乎您希望传递PostPagePath id,而不是文章的标题,例如{{PostPagePath id}}或类似内容。

我在路由器上遇到类似问题,发现它已被弃用

对我来说,决议是安装陨石并添加:

然后,您可以按如下方式进行布线:

Router.map(function() {
     this.route('postslist', {path: '/'})
    //read the docs for your next routing needs


});
我假设您已经安装了meteorite,如果您还没有安装并且正在使用uBuntu或类似的版本,您可以使用以下工具轻松安装:

export PATH=~/.meteor/tools/latest/bin:$PATH    //ensure you are in your project root directory

npm install -g meteorite    //must have npm installed

从stackoverflow中找到了答案

谢谢你的建议,詹姆斯!
Router.map(function() {
     this.route('postslist', {path: '/'})
    //read the docs for your next routing needs


});
export PATH=~/.meteor/tools/latest/bin:$PATH    //ensure you are in your project root directory

npm install -g meteorite    //must have npm installed