【发布时间】:2014-04-29 21:00:33
【问题描述】:
我有一个如下所示的锚标记:
<a href="/folder/folderid">name</a>
点击这个锚标记我正在这样做
handleAnchorClick: function(e) {
console.log("target:",e.target);
console.log("href:",e.target.href);
event.preventDefault();
// navigate to this folder using my app router
backbonerouter.navigate(e.target.href,{trigger:true}); //does not work as the value is wrong
// tries to navigate to this: mydomain.com/mydomain.com/folder/folderid
}
控制台日志语句给了我这个:
target: <a href="/folder/folderid">name</a>
href: "https://mydomain.com/folder/folderid" //instead of just /folder/folderid
到底发生了什么事,我如何使用我的路由器导航到这个文件夹 ID。
【问题讨论】:
标签: javascript jquery html backbone.js backbone-routing