-
Notifications
You must be signed in to change notification settings - Fork 74
Using FlowRouter
Adam Brodzinski edited this page Sep 13, 2015
·
4 revisions
If you try to initialize Flow Router in your app without any configuration you'll run into a / is not defined
error. This is because it tries to start up FlowRouter before the routes are initialized.
First insert a file into meteor_core/client/lib
and place the following code in it:
// Tell FR to wait until our ES6 code is fully initialized
FlowRouter.wait();
Next in the file that you setup your routes place this call after your routes are defined:
// FlowRouter is now ready to go
FlowRouter.initialize();
Full example of routes:
// routes.js
FlowRouter.route('/', {
name: "Home",
action: function(params, queryParams) {
console.log("Home Page")
},
});
FlowRouter.route('/about', {
name: "About",
action: function(params, queryParams) {
console.log("About page")
},
});
// FlowRouter is now ready to go
FlowRouter.initialize();