Skip to content

Instantly share code, notes, and snippets.

@olivernn
Created June 26, 2012 09:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olivernn/2994611 to your computer and use it in GitHub Desktop.
Save olivernn/2994611 to your computer and use it in GitHub Desktop.
davis with hash routing
Davis.extend(Davis.hashRouting({ forceHashRouting: true }))
app = Davis(function () {
this.settings.handleRouteNotFound = true
this.get('#/foo', function () {
console.log('foo')
})
this.get('#/bar', function () {
console.log('bar')
})
})
@mirzadelic
Copy link

Then i will use it with hashRouting.
This is my code:

    <script type="text/javascript">
        Davis.extend(Davis.hashRouting({ forceHashRouting: true }))

        var app = Davis(function () {
            this.settings.handleRouteNotFound = true
            this.use(Davis.title);

            this.configure(function () {
                this.generateRequestOnPageLoad = true
            });
            this.get('#/welcome/:name', function (req) {
                console.log("Hello " + req.params['name']);
                this.setTitle(req.params['name']);
            });
        });

        app.start();

    </script>

and now url is: http://localhost/davisjs/##/welcome/oliver with 2 #, what to to with that ?
And second question, there is no ! in url, this is not wrong or ?

@olivernn
Copy link
Author

This is related to the following issue - olivernn/davis.js#44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment