Meteor 流星路线中的自定义字段
我在routes.js文件中有许多路由,我想在其中引入一个额外的字段。下面是路线Meteor 流星路线中的自定义字段,meteor,iron-router,Meteor,Iron Router,我在routes.js文件中有许多路由,我想在其中引入一个额外的字段。下面是路线 Router.route('/', { name: 'home', controller: 'LoginController', where: 'client', action:'index' }); 因为我有很多路线,我想通过所有的路线,得到这样的路线名称 _.each(Router.routes, function(route){ console.log(route.getName());
Router.route('/', {
name: 'home',
controller: 'LoginController',
where: 'client',
action:'index'
});
因为我有很多路线,我想通过所有的路线,得到这样的路线名称
_.each(Router.routes, function(route){
console.log(route.getName());
});
我想使用路由名称来生成链接。链接需要链接名,我想把链接名放在路由中
Router.route('/', {
name: 'home',
controller: 'LoginController',
where: 'client',
text: 'Login Link',
action:'index'
});
meteor允许在路由中引入自定义字段吗?我发现有一个
标题
选项,但它不在文档中
而且是这样用的
Router.route('/', {
name: 'login',
controller:'HomeController',
where: 'client',
title: 'login',
icon: 'this is the icon',
action:'index'
});
并获得选择权
Router.routes.forEach(function(route){
console.log(route.getName());
console.log(route.options.title);
console.log(route.options.icon);
});
这就是结果
login
login
this is the icon
因此,即使是自定义选项图标
似乎也能正常工作