Search code examples
javascriptmeteorurl-routingiron-router

iron-router does not render template in Meteor


I have installed the atmosphere package iron:router for my meteor application. I am trying to add a simple route like this:

Router.configure({
layoutTemplate: 'layout',
loadingTemplate: 'loading',
notFoundTemplate: 'notFound'
});

Router.route('/', {
    name : 'homeIndex'
});

I defined a template:

<template name="homeIndex">
    <h1>Test for my meteor application</h1>
</template>

And I add a yield - field to my layoutTemplate:

<template name="layout">
    <div class="container">
        {{> yield}}
    </div>
</template>

But still when I go to '/', I don't see anything of my template.

Also when I'm trying to add another route with another template, it doesn't work. I have installed the package through this command: meteor add iron:router

Can someone please tell me what I'm doing wrong?


Solution

  • When I looked at my console in the browser, I saw the iron router package was throwing an exception that EJSON was undefined in the javascript of the package. I installed the EJSON package with the command meteor add ejson, and it was fixed! But thanks anyway for the help!