2014-10-31 90 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