Question

I have an application which main files look like these (1), (2), (3).

The Backbone.Router works fine in this case (because it triggers #page):

http://localhost/index.php#page

How should I configure it if the url is the following (in order to trigger /some#page):

http://localhost/index.php/some#page

P.S:
the backend of this web app is using Synfony2


(1)

// index.php
<script data-main='mainApp.js' src='require.js'>

(2)

// mainApp.js
define([
  'js/router'
], function(Router) {
    "use strict";
    var initialize = function ()
    {
            Router.initialize();
    }

    return {
        initialize: initialize
    };
});

(3)

// router.js
define([
    'myView'
], function(MyView){
    console.log(MyView)
    var AppRouter = Backbone.Router.extend({
        routes: {
           'page' : 'view'
        },

        view: function () {
          //some code
        }
    });
});
Was it helpful?

Solution

Does this work?

routes: { 
   '/some:page': 'view',
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top