0

I have a path configured for my backbone router as

var myApp = myApp || {};

myApp.router = Backbone.Router.extend({

   routes:{
      "somecontent_:id": "content",
      "":"defaultPath"
  },

  defaultPath: function(){
     //default path 
  },

  content: function(id){
     console.log("some new id"+id);
   }
});

myApp.newRouter = new myApp.router();

my default path looks like[0] and new path [1]

[0]myurl.com/somecontent
[1]myurl.com/somecontent_id

Problem: "somecontent_:id" is not right/have issue and so "content" method is also not get called.

Thanks in advance for any suggestion /advice

edit 1:

I have mentioned my path wrongly . it should be

[0]myurl.com/somecontent/one/two
[1]myurl.com/somecontent/one/two#newcontent_id

I invoke those router from view as

myApp.newRouter.navigate("",true) for [0]
myApp.newRouter.navigate("/newcontent_"+ id, true); for [1]
paul
  • 1,124
  • 9
  • 27
  • 45

0 Answers0