Используя Meteor, я начал с проекта Meteor по умолчанию с...
meteor create --full
Я добавил маршрут в router.js, например:
FlowRouter.route('/group/:_id', {
name: 'App.groups.show',
action() {
if (!logged_in()) {
FlowRouter.go("App.home");
}
else {
this.render('App_body', 'Group');
}
},
});
router.js находится здесь:
/imports/startup/client/router.js
Шаблон группы такой:
<template name="Group">
{{> user_group}}
</template>
И для user_group у меня есть это:
Template.user_group.onCreated(function user_groupOnCreated() {
console.log("id", FlowRouter.getParam('_id'));
});
Это приводит к:
ReferenceError: FlowRouter is not defined
at Blaze.TemplateInstance.user_groupOnCreated (user-group.js:46)
at template.js:119
at Function.Template._withTemplateInstanceFunc (template.js:490)
at fireCallbacks (template.js:115)
at Blaze.View.<anonymous> (template.js:195)
at fireCallbacks (view.js:276)
at Object.Tracker.nonreactive (tracker.js:603)
at view.js:273
at Object.Blaze._withCurrentView (view.js:533)
at Object.Blaze._fireCallbacks (view.js:272)
У меня также нет доступа к FlowRouter.go
в моих шаблонах.
Что мне не хватает?
import { FlowRouter } from ...
в своем файле шаблона - person Jankapunkt   schedule 22.02.2021