javascript - Director.js routing library firing all route handler at the time of initialization -


i trying use directorjs routing library. used example provided @ github reference. firing call handler @ time of initialization.

           var initializeroutes = function(){                  var routes = {                    '/home': launchmodule("home"),                    '/confirmation': launchmodule("confirmation")                };                var router = router(routes);                router.init("/home");             } ;              var launchmodule = function(modulekey){                 reportmailer.utils.moduleloader.launchmodule(modulekey);             }; 

scenario : launch #/home works fine. when click button navigation confirmation route, window location hash changes didn't fire call handler.

to amusement found callbacks called @ time of initialization. please help.

you're calling functions in example. change them to

var routes = {                '/home': function() { launchmodule("home") },                '/confirmation': function() { launchmodule("confirmation") }              }; 

Comments