dylson-v
1/4/2016 - 10:34 PM

Issue with FlowRouter

Issue with FlowRouter

FlowRouter.route('/product/:id', {
  name: 'product',
  action(params) {
    let product = Products.findOne({_id: new Mongo.ObjectID(params.id)});
    
    /**
     * Will return undefined after a browser refresh,  although 
     * sometimes it seems to work fine. However, if activated
     * by FlowRouter.go('product', {id: "a valid id string"}) 
     * will return a collection document as expected 
     */
    console.log(product); 

    BlazeLayout.render("mainLayout", {main: "product"});
  }
});