【发布时间】:2016-01-22 08:35:46
【问题描述】:
我是流星和铁路由器的新手。 Iron 路由器示例不是最新的,不能在 github 上运行。 我只想做一个简单的路线。 这是我的 /client/index.html
<html>
<head>
<title></title>
</head>
<body>
{{> template1OrTemplate2 depending on url}}
</body>
</html>
<template name="template1">
one
</template>
<template name="template2">
two
</template>
我的 /lib/router.js:
Router.route('/templateOne', function () {
// renderMyTemplate1 please
});
Router.route('/templateTwo', function () {
// renderMyTemplate2 please
});
这么容易的东西怎么可能这么难找?
【问题讨论】:
-
Iron Router 不错,但是 FlowRouter 是 Meteor 生态系统的前进方向。
-
这是流路由器github.com/kadirahq/flow-router的文档
-
我已经看过 flowrouter 但它看起来仍然很复杂,只是路由。而且我没有找到如何用 flowrouter 做我的例子
标签: javascript meteor iron-router router