2014-10-31 190 views
2

铁路由器中是否还存在此命令?为什么我得到这个错误?Router.go()发生了什么?

TypeError: Object function router(req, res, next) {               // 13 
    //XXX this assumes no other routers on the parent stack which we should probably fix  // 14 
    router.dispatch(req.url, {                // 15 
     request: req,                   // 16 
     response: res                   // 17 
    }, next);                     // 18 
    } has no method 'go' 

回答

6

如果要在启动时运行,您必须将它包装在“if(Meteor.isClient)”中。这很有趣,因为你可以调用Router.route(),它们没有被包装,并且运行良好。

+0

谢谢,这对我很好! – 2015-04-09 10:33:00