I am using Meteor with the iron:router package. I am trying to just render a basic template into a layout template, but keep receiving the error:
Exception from Tracker recompute function: Error: Couldn't find a template named "/" or "". Are you sure you defined it?
For my '/' route, I have the following:
// router.js
Router.configure({
layout: 'layout'
});
Router.route('/', function () {
this.render('welcome');
});
My templates looks like:
<!--main.html -->
<head>
<title>App</title>
</head>
<body>
</body>
<template name='layout'>
<div id='container'>
{{> yield}}
</div>
</template>
<template name='welcome'>
<p>Welcome</p>
</template>
For my package, I initially tried just installing the iron:router plugin. It seemed to add iron:core, iron:dynamic-templates, and iron:layout. I have since added each library separately:
> meteor list
iron:core 0.3.4 Iron namespace and utilities.
iron:dynamic-template 0.4.1 Dynamically create and update templates and the...
iron:layout 0.4.1 Dynamic layouts which enable rendering dynamic ...
iron:router 0.9.4 Routing specifically designed for Meteor
meteor-platform 1.1.1 Include a standard set of Meteor packages in yo...
Try modifying your router.js
to :
Router.configure({
layoutTemplate: 'layout' // layoutTemplate, not layout
});
Router.route('/',{
// give the the route a name to help it find your welcome template
// let the default action function render the layout + template for you
name:"welcome"
});
You can get rid of the empty body too, and FYI you don't need to manually add iron:router
dependencies : that's what a package system is for in the first place :)