Question

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:

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

calendar.html:

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

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:

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

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

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.

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

Thanks in advance.

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.

Était-ce utile?

La solution

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.

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top