You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using waitOn hook wait for template and subscription to be ready
Using action hook to render article template into layout
Using data hook fetch data from Collection
If article doesn't exists (bad_idis provided) - render 404 template using onNoData hook
import{FlowRouter}from'meteor/ostrio:flow-router-extra';// Import layout, loading and notFound templates statically as it will be used a lotimport'/imports/client/layout/layout.js';import'/imports/client/loading/loading.html';import'/imports/client/notFound/notFound.html';// Create article routeFlowRouter.route('/article/:_id',{name: 'article',waitOn(params){return[import('/imports/client/article/article.html'),Meteor.subscribe('article',params._id)];},whileWaiting(){this.render('layout','loading');},action(params,qs,article){this.render('layout','article',{ article });},data(params){returnArticlesCollection.findOne({_id: params._id});},onNoData(){this.render('notFound');}});