骨干路由器不起作用

时间:2013-10-23 08:13:52

标签: backbone.js meteor router

所以我有一个这样的Backbone路由器表:

var TodosRouter = Backbone.Router.extend({
 routes: {
":roles_id": "main",
":edit/:roles_id_editInfos": "edit",
":changepass/:id_user": "changepass"
},
main: function (list_id) {
var oldList = Session.get("roles_id");
if (oldList !== list_id) {
  Session.set("roles_id", list_id);
  Session.set("roles_id_editInfos", null);
  Session.set("id_user", null);
}
},
 edit: function (list_id, list_id2) {
var oldList = Session.get("roles_id_editInfos");
if (oldList !== list_id) {
  Session.set("roles_id_editInfos", list_id2);
  Session.set('roles_id', null);
  Session.set("id_user", null);
}
},
 changepass: function (list_id3, list_id4) {
 var oldList = Session.get("id_user");
  if(oldList !== list_id3){
    Session.set('id_user', list_id4);
    Session.set('roles_id', null);
    Session.set("roles_id_editInfos", null);
}
},
setList: function (list_id) {
this.navigate(list_id, true);
}
});

Router = new TodosRouter;

Meteor.startup(function () {
  Backbone.history.start({pushState: true});
});

由于某些原因,当我点击链接时 - > '/ changepass / {{_ id}}'它不起作用。 但是,当我点击另一个时,它就会起作用,如果我删除了“编辑”路线,例如,'changepass'路线就会起作用。

Backbone路由器有路由限制吗?

你能帮帮我吗? :)

1 个答案:

答案 0 :(得分:0)

routes: {
":roles_id": "main",
":edit/:roles_id_editInfos": "edit",
":changepass/:id_user": "changepass"
},

为什么你在路线之前使用冒号?