简体   繁体   English

铁路由器notFound模板在流星中不起作用

[英]iron-router notFound template not working in meteor

// 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/ " working perfectly http://hedcet.com:3000/ ”可以正常工作

but

when i try " http://hedcet.com:3000/x " (route /x) which is not defined in router.js, it shows an error in console & not show notFound template 当我尝试在router.js中未定义的“ http://hedcet.com:3000/x ”(路由/ x)时,它在控制台中显示错误且未显示notFound模板

// console error

Uncaught Error: Oh no! No route found for path: "/x"

could u suggest any solution ? 您能提出任何解决方案吗? i want to show notFound template if any try a non existing path in meteor 如果要尝试流星中不存在的路径,我想显示notFound模板

您在notFoundtemplate中得到的“ t”应该是“ T”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM