2014-12-18 79 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