简体   繁体   English

Meteor.js:铁:包括名称的路由器

[英]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.

相关问题 带有Iron Router按钮的Meteor.js和模板中的表单不起作用 - Meteor.js with Iron Router buttons and forms in templates not working Meteor.js Spiderable和Iron Router - 生产服务器上的光纤错误 - Meteor.js Spiderable and Iron Router - fiber error on production server Meteor.js铁路由器和类似或动态路由 - Meteor.js Iron Router and similar or dynamic routes 对于 Meteor.js 应用程序中的铁路由路由来说,真正的“window.onload”等价物是什么? - What is a true equivalent of `window.onload` for an iron router route in a Meteor.js app? Meteor.js把手根据Iron Router中的当前路线返回不同的文本 - Meteor.js Handlebar Returns different Text depending on current Route in Iron Router Meteor.js iron:路由器服务器路由触发器RangeError:超出最大调用堆栈大小 - Meteor.js iron:router server route triggers RangeError: Maximum call stack size exceeded 使用Iron-Router转到Meteor.js中页面的特定ID部分(url#portion) - Using iron-router to go to a certain id section of the page (url#portion) in Meteor.js meteor.js iron-router:防止静态模板重新渲染和毛刺? - meteor.js iron-router: prevent static template re-render and glitching? 使用Iron Router在流星包中包含HTML模板 - Including an HTML Template in a Meteor Package with Iron Router 流星JS Iron Router,路由子目录 - Meteor JS Iron Router, route sub directory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM