小编jth*_*_92的帖子

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不起作用

起始URL是http://localhost:13060/Category.当我添加一个类别时,它应该转到http://localhost:13060/Category#/#id(其中id是新的id)并向下滚动页面.URL正在更新但$ anchorScroll不滚动.

 //jump to new category
 $location.path("");
 $location.hash(cat.ID);
 $anchorScroll();
Run Code Online (Sandbox Code Playgroud)

hashtag angularjs anchor-scroll

8
推荐指数
1
解决办法
6422
查看次数

标签 统计

anchor-scroll ×1

angularjs ×1

hashtag ×1