Meteor & iron-router: TypeError: undefined is not a function

Meteor & iron-router: TypeError: undefined is not a function

我在没有路由的情况下制作了简单的页面并且它工作得很好,但是在添加路由之后我的浏览器控制台出现了这个错误:

TypeError: undefined is not a function

我的router.js:

Router.configure({
  layoutTemplate: 'layout'
});
Router.map(function() {
  this.route('index', {path: '/'});
});

我的layout.html:

<tempate name = "layout">
<html>
<head>
... includes here
</head>
<body>
<div class="container"> 
  {{ >yield }}
</div>
</body>
</html>
</template>

我的index.html:

<template name="index">
<input type="checkbox" name="choiceMe" class="typeChoice" checked>

<script>
  var options = {
    onText: "ON",
    offText: "OFF",
  };
  $("[name='choiceMe']").bootstrapSwitch(options);
</script>
</template>

如何解决?

head 不应包含在模板中。

layout.html更改为:

<head>
... includes here
</head>

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