【发布时间】:2014-04-22 07:05:20
【问题描述】:
// main.html
<template name="layout">
{{yield}}
</template>
<template name="notFound">
notFound
</template>
// router.js
Router.configure({
layoutTemplate: "layout",
loadingTemplate: "loading",
notFoundtemplate: "notFound"
});
Router.map(function() {
this.route('home', {
path: '/'
});
});
“http://hedcet.com:3000/”完美运行
但是
当我尝试未在 router.js 中定义的“http://hedcet.com:3000/x”(路由 /x)时,它在控制台中显示错误并且不显示 notFound 模板
// console error
Uncaught Error: Oh no! No route found for path: "/x"
您能提出任何解决方案吗?如果有任何尝试流星中不存在的路径,我想显示 notFound 模板
【问题讨论】:
标签: javascript meteor meteorite iron-router