2016-04-16 7 views
0

私は流星アプリケーションに複数のページを作成しようとしています。流星1.3.1と最新の鉄道ルータを走っています。鉄道ルータは1つのルートでしか動作しません

これは私のmain.jsファイルです。私はhello there!

見ることができますhttp://localhost:3000/homeに移動した場合

Router.route('/home', function() { 
    this.render('home'); 
}); 
Router.route('/register', function() { 
    this.render('register'); 
}); 

は、これが今の私のmain.htmlをファイル

<template name="home"> 
    <h1>Hello there !</h1> 
</template> 
<template name="about"> 
    <h1>this is an about page!</h1> 
</template> 
<template name="register"> 
    <h2>Register</h2> 
</template> 

である。しかし、私はhttp://localhost:3000/registerにナビゲートする場合、私はしかし、 Oops, looks like there's no route on the client or the server for url: "http://localhost:3000/register."

を見ますjsファイルのルートの位置を次のように変更した場合:

Router.route('/register', function() { 
    this.render('register'); 
}); 
Router.route('/home', function() { 
    this.render('home'); 
}); 

この場合、登録ページは機能し、ホームページは表示されません。

答えて

0

は代わりにRouter.map構文を試してみてください:

Router.map(function() { 
    this.route('home', {path: '/home',}); 
    this.route('register', {path: '/register',}); 
}); 
0

ので、私はそれがうまく働いたGoogleのクロムを使用すると、クロムカナリア(クロムの実験バージョン)を使用していたので、それが機能しなかったことが判明。

関連する問題