<a routerLink="/Profile">Profile</a>
在 index.html 文件中使用时遇到问题。锚标记无法正常工作。我在 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中
<a routerLink="/Profile">Profile</a>
当我将它放在任何其他组件中但在 index.html 中不起作用时,相同的行代码工作文件