Closed WayneUong closed 7 years ago
@WayneUong ,
Thank you for suggestion. My guess same should also apply to the route groups, right?
@dr-dimitru Yeah on the route group level would be great too. Btw, I'm transitioning from the old FlowRouter and the global namespace seems to be gone. Right now I have to do a hack:
import {FlowRouter as flowRouter} from '...';
FlowRouter = flowRouter;
Is there a better way? We have too many unimported FlowRouter's around. Thank you.
Btw, I'm transitioning from the old
Great
the global namespace seems to be gone
Yes, thanks to Meteor new principles
Is there a better way?
// The best way to make sure you follow new Meteor principles
import { FlowRouter } from 'meteor/ostrio:flow-router-extra';
// Expose FlowRouter to the global will work too
// This will work on both Client and Server
// Best if this done in the /lib/
import {FlowRouter as flowRouter} from 'meteor/ostrio:flow-router-extra';
this.FlowRouter = global.FlowRouter = flowRouter;
Thanks @dr-dimitru very nice package with lots of good features.
@WayneUong thank you for feedback, this means a lot for me, and feature suggestion, it will arrive on next release.
Please, support this project by:
Hi @dr-dimitru!
layout.js:
import './layout.html';
import './main.html';
import './main.js';
import '/imports/ui/service.js';
routes.js (don't works):
FlowRouter.route('/cart',{
name: 'cartItems',
loadingTemplate: 'loading',
waitOn() {
import('/imports/ui/cart/layout.js');
},
but
FlowRouter.route('/cart',{
name: 'cartItems',
loadingTemplate: 'loading',
waitOn() {
return [import('/imports/ui/cart/layout.html'),
import('/imports/ui/cart/main.html'),
import('/imports/ui/cart/main.js'),
import('/imports/ui/service.js')]
// import('/imports/ui/cart/layout.js');
},
works! when bunch files is large, how improve this?
Hello @valorloff ,
You're missing return
key word here:
FlowRouter.route('/cart',{
name: 'cartItems',
loadingTemplate: 'loading',
waitOn() {
+ return import('/imports/ui/cart/layout.js');
- import('/imports/ui/cart/layout.js');
},
sorry, ...shame :)
@valorloff solved?
sure! It's a stupid mistake, thanks! per route DynImport works nice
Great, no worries. Thank you for support and the choice )
+1 for Group route dynamic imports. I have a system admin panel that I would prefer to import all the system stuff in once there and not in each route :)
Keep up the great work. These are nice additions to FlowRouter!
Like this?