Skip to content

Latest commit

 

History

History
29 lines (21 loc) · 1.38 KB

initialize.md

File metadata and controls

29 lines (21 loc) · 1.38 KB

initialize method

FlowRouter.initialize(options);
  • options {Object}
    • hashbang {Boolean} - Enable hashbang urls like mydomain.com/#!/mypath, default: false
    • page {Object} - Options for page.js
      • click {Boolean} - When false, <a href> tags in your app won't automatically call flow router and will do the browser's default page load instead. This is identical to how react-router behaves. You can create a <Link /> component that calls FlowRouter.go in its onClick handler. This way, you have more control over your links. Default: true
      • Other options can be found in a page.js docs
  • Returns {void}

By default, FlowRouter initializes the routing process in a Meteor.startup() callback. This works for most of the applications. But, some applications have custom initializations and FlowRouter needs to initialize after that.

So, that's where FlowRouter.wait() comes to save you. You need to call it directly inside your JavaScript file. After that, whenever your app is ready call FlowRouter.initialize().

Example

FlowRouter.wait();
WhenEverYourAppIsReady(() => {
  FlowRouter.initialize();
});

Further reading