maxcnunes / Perfin

Personal Finance Control - Easy and Simple
http://perfinster.com/
1 stars 1 forks source link

Have been loaded default view infinitely #3

Closed maxcnunes closed 11 years ago

maxcnunes commented 11 years ago

For some reason the sammy is running infinitely the run route. Probably because the startupUrl is always empty.

I had to comment the code below because was always crashing the chrome. This is just a work around and have to be fixed:

//file: router.js

this.get('', function () {
    //---------------------------------------------------------------//
    // FIX THIS CODE LATER,  have been loaded default view infinitely //
    //---------------------------------------------------------------//
    //this.app.runRoute('get', startupUrl);
});`
maxcnunes commented 11 years ago

Fixed

The problem was happening because the root url should be an empty value but actually is '/'. So now is this way:

rootUrl = window.location.pathname,// usually is '/'

sammy = new Sammy.Application(function () {
    if (Sammy.Title) {
        this.use(Sammy.Title);
        this.setTitle(config.title);
    }

    // define a route for the root url that usually is '/'
    this.get(rootUrl, function () {
        this.app.runRoute('get', startupUrl);
    });
}),