mapRoutes clear example of callback

24 views
Skip to first unread message

Miroslav Zografski

unread,
Dec 12, 2014, 8:08:37 AM12/12/14
to sam...@googlegroups.com
Hello  all, 

Can someone provide a clear example on using mapRoutes with callback. I have tried a simple test like:
(function($){
 
var test = function(){
 console
.log('test');
 
},
 home
= function(){
 console
.log('home');
 
},
 routesArr  
= [
 
['get', '#/home', home],
 
['get', '#/test', test]
 
],
 app
=  Sammy();


 app
.mapRoutes(routesArr);


 app
.run('#/home');


})(jQuery);


But the home or test functions are only executed on full page refresh but not as callbacks of the routes. 
Appreciate any help!

Regards, 
MZ

Miroslav Zografski

unread,
Dec 12, 2014, 8:16:20 AM12/12/14
to sam...@googlegroups.com
Please, ignore my ignorance... 
I haven't set the app.run() to be executed on DOM ready.
Reply all
Reply to author
Forward
0 new messages