ONYX
ONYX

Reputation: 5859

querystring with backbone marionette router

I'm trying to output the query string but I'm not getting anything but null.

My query string is http:://localhost/admin/brands?foo=bar and queryString is always null also tried /brands/?foo=bar but no luck

App.Router = Marionette.AppRouter.extend({
    routes: {
        '(?*queryString)': 'index',
        'create': 'create',
        'edit/:id': 'edit',
        'show/:id': 'show',
    },      
    index: function(queryString) {

        console.log('index page');

        //let qs = helper.parseQueryString(queryString);
        console.log(queryString);
    }
}

Upvotes: 2

Views: 74

Answers (1)

T J
T J

Reputation: 43156

You probably need to enable push state like Backbone.history.start({pushState: true}) or your URL should contain # like http:://localhost/admin/brands#?foo=bar

Upvotes: 3

Related Questions