Meteor router doesn't render the template

旧时模样 提交于 2019-12-24 00:02:23

问题


I created a route and gave it a path to a template. But when I run the application, it says that 'there is no route'. Router simply doesn't follow the path. (I am sure the router package is installed because if I don't create and specify any route, on the main page appears the default message how to use a router)

HTML:

<head>
    <title>todos</title>
</head>

<body>
    {{>todos}}
</body>

<template name="register">
    <h2>Register</h2>
</template>

route.js:

  Router.route('/register');

回答1:


Creating a new project with just the code/markup (and adding iron:router) I see two errors in the browser console:

  • Uncaught Error: No such template: todos
  • Exception in callback of async function: ReferenceError: EJSON is not defined (truncated)

So the first one is simple - add a template called todos, or remove the markup that includes it.

And the second error is being thrown by iron:router. It must have a dependency on the ejson package that is no longer included by default in the meteor base packages.

meteor add ejson

Will fix this, and the /register route will then work.



来源:https://stackoverflow.com/questions/32912767/meteor-router-doesnt-render-the-template

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!