创建Meteor.Router.add()后,Meteor显示[object Object] [英] Meteor showing [object Object] after creating Meteor.Router.add()

查看:91
本文介绍了创建Meteor.Router.add()后,Meteor显示[object Object]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注本教程以学习Meteor。添加第一个JS代码后,我在浏览器上获得[object Object]。我已经按照所解释的一切(除了我已经改变的一些名字,但我没有使用任何保留字),但我看不到任何其他内容。这部分是在前4分钟。这就是我的文件外观:

I'm following this tutorial to learn Meteor. After adding the first JS code, I'm getting [object Object] on my browser. I've followed everything as explained (except for some names that I have changed, but I haven't used any reserved words), but I cannot see anything else. This part is in the first 4 minutes. This is how my files look:

demonstration.js:

demonstration.js:

CalEvents = new Meteor.Collection('calevents');
Session.setDefault('editing_calevent', null);
Session.setDefault('showEditEvent', false);
Meteor.Router.add({
    '/':'home',
    '/calendar':'calendar'  
})

calendar.html:

calendar.html:

<template name="calendar">
    <div id="calendar">
        Hello world! Now at calendar.
    </div>
</template>

home.html:

home.html:

<template name="home">
    <div class="hero-unit">
        <p>Manage your calendar</p>
        <p><a class="btn btn-primary btn-large">Learn more</a></p>
    </div>  
</template>

demonstration.html:

demonstration.html:

<head>
  <title>Calendar app</title>
</head>

<body>
  {{>menu}}
    <div class="container-fluid">
        <div class="row-fluid"> 
            {{renderPage}}
        </div>
    </div>
</body>

我怀疑它与Meteor.Router.add()行有关,因为这个我之前添加了这个工作。我已经尝试将页面更改为显示在包含简单文本的其他页面上的/,但它不起作用。

I suspect it has something to do with the Meteor.Router.add() line, because the little I did prior to adding this worked. I have tried changing the page to show on '/' to other pages that contained a simple text, but it didn't work.

编辑添加:我正在工作通过Nitrous.io和我在添加路由器包之前安装了Meteorite。

Edit to add: I am working thru Nitrous.io and I installed Meteorite prior to adding the router package.

提前致谢。

PS :我在这里和谷歌搜索过,但我找不到这个问题的答案。如果有的话,请将我指向正确的地址。

PS: I have searched in here and on Google but I haven't been able to find any answer to this question. If there is one, kindly point me to the right address.

推荐答案

许多在0.8版之前使用Meteor的示例都不会工作,所以请务必查看最近更新的示例,例如发现流星上的示例。

Lots of examples that use Meteor prior to version 0.8 will not work, so make sure you check out a recently updated example, like those on Discover Meteor.

在这种情况下,已修复路由器以支持Meteor 0.8 ,您的示例将正常工作用替换 {{renderPage}} {{> renderPage}} 。但是,该示例的其余部分可能无法正常工作,并且正如其他人所提到的,已弃用路由器以用于铁路由​​器

In this case, router has been fixed to support Meteor 0.8 and your example will work by replacing {{renderPage}} with {{> renderPage}}. However, the rest of the example probably won't work, and as others have mentioned, router has been deprecated for Iron Router.

这篇关于创建Meteor.Router.add()后,Meteor显示[object Object]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆