【发布时间】:2018-04-28 15:53:37
【问题描述】:
在 index.html 文件中使用 <a routerLink="/Profile">Profile</a> 时遇到问题。锚标记无法正常工作。我在 index.html 上放置了标题菜单,并希望为 Angular 4 中的路由添加以下代码
<a href="#Profile" routerLink="/Profile" routerLinkActive="active">
<span class="icon-cogs"></span>Profile</a>
<router-outlet></router-outlet>放在app.component.html中
当我将它放在任何其他组件中但在 index.html 中不起作用时,相同的行代码 <a routerLink="/Profile">Profile</a> 工作文件
【问题讨论】:
-
同时删除
href="#Profile"。 -
你能提供给我们你的项目结构吗?