AngularJS提出了斜杠/后哈希标记
我正在尝试将AngularJS
$anchorScroll 与$location.hash一起使用.但是,当我设置哈希值时,AngularJS会在其后面添加一个正斜杠.
例如,网址为:http:// localhost:13060 / Dashboard.当我不包括AngularJS库时,我可以单击链接#contact,然后转到http:// localhost:13060 / Dashboard #contact. 但是当我包含AngularJS并单击该链接时,它会转到http:// localhost:13060 / Dashboard#/ contact,以防止$anchorScroll工作. 编辑$anchorScroll不起作用 //jump to new category $location.path(""); $location.hash(cat.ID); $anchorScroll();
除非你使用html5mode,它从角度路由中删除散列,你将有2个哈希值,一个用于角度路由,另一个用于锚点.
HTTP://本地主机:13060 /仪表板#/#接触 假设您将路径路径设置为/ profiles并且锚点位于该视图中,则url将如下所示: HTTP://本地主机:13060 /仪表板#/型材#接触 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |