Closed perminder-klair closed 9 years ago
I think there's a bug in Iron.Router, not sure tho...
Anyway, as a workaround, put apostrophes around the PreloadController
:
controller: 'PreloadController',
That should do it.
great! many thanks @MiroHibler !
Just tried with apostrophes still same issue.
Please suggest.
Could you post some code?
Sure, here it is: https://codio.com/perminder-klair/Meteor-Preloader
try to run, and it gives this error: Error: RouteController 'PreloadController' is not defined.
Route is located at: /lib/router/home.js
Oh, I see - as with SEO package, PreloadController is only available on client side, so you should isolate it by defining your routes in a client side file (i.e. /client/lib/router/home.js).
One of the next versions will take care of that.
Thanks, Just tried to move routes to client, same issue.
Where do you get the error ReferenceError: PreloadController is not defined
, in server console or in a browser console?
Hi @MiroHibler , i get this error at both places server and browser.
Make sure that you add the package with:
meteor add miro:preloader
then check it out with:
meteor list
It should appear in the list of active packages.
Any luck?
Hello @MiroHibler ,
I just checked with meteor list
it gives following result:
miro:preloader 1.1.0 A synchronous/asynchronous Meteor preloader for external .js and .css libraries
But when I try to run app, it still gives same error, this is code I have in my route:
Router.route('/', {
name: 'home',
controller: 'PreloadController',
//fastRender: true,
onAfterAction: function () {
//var post;
// The SEO object is only available on the client.
// Return if you define your routes on the server, too.
if (!Meteor.isClient) {
return;
}
SEO.set({
title: 'Home - ' + Meteor.App.NAME,
meta: {
'description': 'Welcome to my site.'
}
});
}
});
Error is:
Error: RouteController 'PreloadController' is not defined.
Code is available at: https://codio.com/perminder-klair/Meteor-Preloader
Feel free to fork or zip it and try running locally to debug.
According to the sample code you provided, you're still loading PreloadController
on both server- and client-side, which is not yet supported. It works only client-side.
As a quick workaround, move your /lib/router
folder to /client/lib/router
folder - that way you'll ensure PreloadController
is loaded only client-side.
@MiroHibler thanks, works under client directory.
Thanks for support! looking forward until support on server side.
Thanks again!
You're welcome! :)
Happy coding!
Hello,
First of all, thanks for your awesome work!
I added package to my app, then when in route I added PreloadedController with:
controller: PreloadController,
It returns this error:
ReferenceError: PreloadController is not defined
Any solution or suggestion?
Many thanks!!