什么是错误“模板助手中的异常:错误:带名称的处理程序'路径查找器'已经存在了。“是吗?

时间:2015-08-30 20:03:18

标签: javascript html meteor

我的代码是

Template.homeItem.helpers({
  'shareData': function() {
  return {
title: this.title,
 author:Meteor.users.findOne(this.createdBy),//createdBy stores the author's userId
url:  Router.map(function(){
Router.route('/content/:_id',{
name:'pathFinder',
template:'pathFinder',
data: function(){
  var currentRoute= this.params._id;
  return contentsList.findOne({_id: currentRoute});
  }});})}}

我不知道在shareit的shareData中传递url的正确方法。

感谢每个人

1 个答案:

答案 0 :(得分:1)

首先,请正确缩进代码。这是非常难以理解的,并且由于压痕不良而包含错误。

对你的问题;这意味着您已经创建了具有该名称的路线。

很难说出你想要实现的目标,但我认为你正试图做这样的事情:

Template.homeItem.helpers({
  'shareData': function() {
    return {
      title: this.title,
      author: Meteor.users.findOne(this.createdBy),
      url: '/content/' + this._id
    }
  }
})
相关问题