2014-12-18 57 views
0

当我从documentnaton这些理解是创建一个路由步骤的击打它不工作流星基本的路由不工作,它的基本的,但不工作

我的流星版本是:流星1.0.1

根@本地基本]#流星补充铁剂:在版本1.0.4
添加了铁的位置:路由器 添加了铁的动态模板在版本1.0.5 补充铁剂:在版本1.0.5路由器
添加的铁:布局在版本1.0.5
添加的铁:中间件堆叠在版本1.0.4 添加的铁:URL在版本1.0.4
添加的铁:控制器在版本1.0.4
添加的铁:在芯版本1.0.4

与下面的代码,但它始终与显示出任何空白页尝试示例应用程序

My code as follows 
this is basic.js 

Router.map(function() { 
    this.route('hi', { 
    path: '/hi',"enter code here" 
    template: 'hello' 
    }); 
}); 

# this is basic.html 

<head> 
    <title>Meteor Routing Test</title> 
</head> 

<body> 
    {{> yield}} 
</body> 

<template name="hello"> 
    <h1>Hello World!</h1> 
</template> 

Can you please guide me if i am doing something wrong enter code here. I am opening this in http://locahost:3000 and http://locahost:3000/hi but not at all working 
+0

您正在使用旧的Iron Router API和'Router.map'。尝试使用[官方Iron Router指南](https://github.com/EventedMind/iron-router/blob/devel/Guide.md)中指定的新API。 – sbking 2014-12-18 22:23:23

+0

另外,你能指出你正在阅读的文档的来源吗? Meteor文档(http://docs.meteor.com/#/full/)没有说明如何使用Iron Router,因为它不是Meteor核心的一部分。 – sbking 2014-12-18 22:53:18

回答

0

首先为sbking说,你可以使用从铁更近的路由定义:路由器为您路由如:

在basic.js

//definition of the route 
Router.route('/hi', function() { //Here the path 
    this.render('hello');  // Here the name of the template you want to render 
}); 

您有“/”,所以你会看到什么在http://localhost:3000/ 但是如果你去http://locahost:3000/hi通常你会看到你的世界,你好

但去阅读的路由铁:路由器指南!这是值得的 !

+0

非常感谢,我阅读了文档 – 2014-12-19 21:57:00