【发布时间】:2018-01-13 22:09:58
【问题描述】:
我使用了angular ui路由器,就像
.state('home', {
url: '/home',
templateUrl: 'view/home/home.html',
controller: 'homeCtrl'
})
.state('guide', {
url: '/guide',
templateUrl: 'view/guide/guide.html',
controller: 'guideCtrl'
})
我可以在浏览器中使用 url http://localhost:8000/dist/#/home 访问 但是,我不能在我的 html 中使用锚点 如果 home.html 中有这样的锚
<a href="#aaa">scroll to aaa</a>
....
<h1 id="aaa">AAA</h1>
当我点击“滚动到 aaa”时,网址将是 http://localhost:8000/dist/#/aaa 并返回一个空白页。home.html 中的锚点不起作用。
我该如何解决这个问题?
【问题讨论】:
-
你想要发生什么?重定向到外部网站?还是到您应用程序中的默认路由?