铁路由器和this.next()

时间:2015-03-10 22:37:30

标签: meteor iron-router

我有以下路线正在运作:

Router.route('/', function () {
  Meteor.call("get_country", function(error, result){

   if(!error){

    if(result === null)
     Session.setDefault("country", "int");
    else{
    if(Countries[result] === null)
      Session.setDefault("country", "int");
    else
      Session.setDefault("country", result);
    }
  Session.setDefault('category', Countries[Session.get("country")]);
  Session.setDefault('sources', Categories[Session.get("country")][Session.get("category")]);
  }
 });
});

但是在控制台中,我得到了

Route dispatch never rendered. Did you forget to call this.next() in an onBeforeAction?

我不使用onBeforeAction。 我应该注意警告吗?我该如何解决?

1 个答案:

答案 0 :(得分:1)

非常确定您需要指定要加载/渲染的模板:

Router.route('/', function () {
  Meteor.call("get_country", function(error, result){

   if(!error){

    if(result === null)
     Session.setDefault("country", "int");
    else{
    if(Countries[result] === null)
      Session.setDefault("country", "int");
    else
      Session.setDefault("country", result);
    }
  Session.setDefault('category', Countries[Session.get("country")]);
  Session.setDefault('sources', Categories[Session.get("country")][Session.get("category")]);
  }
  //Specify template to render
  this.render('templateNameForHomeRoute');
 });
});
相关问题