[英]Meteor.js: iron:router including name
In tutorials I found two ways of using iron:router: 在教程中,我发现了使用iron:router的两种方法:
First one: 第一:
Router.route("/", function(){
this.render("navbarMain", {
to: "navigation"
});
this.render("firstPage",{
to: "main"
});
Second one: 第二个:
Router.route("/", {
name: "home",
template: "home"
});
I would like to add name attribute to the first code; 我想在第一个代码中添加name属性; I tried adding it in differenet places, but none seems to work. 我尝试将其添加到differentenet位置,但似乎无济于事。 Where should I put it or there is no way to combine those two? 我应该放在哪里,或者没有办法将两者结合起来? In that case, how can I refer to the root page (in pathFor)? 在这种情况下,如何引用根目录(在pathFor中)?
This should work. 这应该工作。
Router.route("/", function(){
this.render("navbarMain", {
to: "navigation"
});
this.render("firstPage",{
to: "main"
});
}, {
name: 'home'
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.