I'm new to meteor and iron router. Iron router example are not up to date and not working on github. I just want to make a simple route. Here is my /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>
my /lib/router.js:
Router.route('/templateOne', function () {
// renderMyTemplate1 please
});
Router.route('/templateTwo', function () {
// renderMyTemplate2 please
});
How is it possible something that easy is so hard to find?
For Flow Router :-
ensure you have done...
meteor add kadira:flow-router kadira:blaze-layout
then
FlowRouter.route('/templateOne', {
action() {
BlazeLayout.render("template1");
}
})
FlowRouter.route('/templateTwo', {
action() {
BlazeLayout.render("template2");
}
})
With a layout you'd do something like
<template name="layout">
<div>My App</div>
{{>Template.dynamic template=content}}
</template>
then
FlowRouter.route('/templateOne', {
action() {
BlazeLayout.render("layout", {content:"template1"});
}
})