[Solved] FlowRouter.getParam throws Exception in template helper

I use ostrio:flow-router-extra.

I have a route:

FlowRouter.route('/article/:_articleId', {
	name: "article",
	action: function(params, queryParams) {
		BlazeLayout.render("mainLayout", {content: "article"});

For the article template, I have a helper:

article() {
	var articleId = FlowRouter.getParam('_articleId');

	return News.findOne({_id: articleId});

When visiting /article/13, the console returns:

Exception in template helper: article@http://localhost

The route renders using the correct template, but the requested article is not retrieved.

What is causing this?

I had to explicitly include the router in article.js.

import { FlowRouter } from 'meteor/ostrio:flow-router-extra';

1 Like