문제

I want to have the hash url like this,

site.com/#/page/edit/about-us/

so I set the router in my backbone,

routes: {
        '/page/edit/:url/':    'renderDynamicPage',
    },

    renderDynamicPage: function (url) {
        console.log(url);
    },

but nothing comes out.

it should be about-us

any ideas why and how I can get around to this?

도움이 되었습니까?

해결책

Backbone.js documentation says

Note that you'll want to avoid using a leading slash

try

routes: {
        'page/edit/:url':    'renderDynamicPage',
    },

    renderDynamicPage: function (url) {
        console.log(url);
    },
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top