【问题标题】:How to pass parameter which is in object to pathfor in meteor?如何将对象中的参数传递给流星中的pathfor?
【发布时间】:2015-09-21 04:03:09
【问题描述】:

下面是我的对象。我想发送对象内部存在的“554b9960f046be881a344779”。

{
  _id: {
    _str : "554b9960f046be881a344779"
   },
  title : "Hello world"
}

我试过<a href="{{pathFor 'article' _id = _id._str}}" > {{title}} </a>,但没有用。

【问题讨论】:

    标签: meteor handlebars.js iron-router meteorite


    【解决方案1】:

    你确定你有数据上下文吗?试试this

    <a href="{{pathFor 'article' _id = this._id._str}}" > {{title}}  </a>
    

    它在没有this 的情况下也可以工作,请确保您有可用的数据上下文

    【讨论】:

    • 谢谢伙计。内容不可用。无论有无this,它都可以工作。非常感谢
    猜你喜欢
    • 1970-01-01
    • 2015-06-07
    • 1970-01-01
    • 2013-08-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-24
    • 2013-08-04
    相关资源
    最近更新 更多