Reputation: 2910
I'm restructuring my Meteor/Blaze app to keep related items in 'modules'. But I'm experiencing an issue with the first template.
My file structure is this:
/imports
/modules
index.js
/admin
index.js
methods.js
/client
adminPage.html
adminPage.js
The index.js files are loading fine. The adminPage.js
is being imported alongside adminPage.html
. But when I created Template.adminPage.onCreated(...)
I got an error message, that I cannot call a function on undefined.
Calling console.log(Template)
in the adminPage.js
file returns this:
Section showing the admin page in console.log output.
But if I run console.log(Template.adminPage)
I get undefined
. I'm not sure what to look for next.
Upvotes: 0
Views: 191
Reputation: 2910
I found the issue. Instead of the correct:
import { Template } from 'meteor/templating';
I used
import Template from 'meteor/templating';
Upvotes: 1
Reputation: 3240
You are probably missing an import statement in /imports/modules/admin/client/adminPage.js
. At the top of this file add the following:
import './adminPage.html';
Upvotes: 0