[英]<a routerLink=“#Profile”>Profile</a> Is not woking in angular 4
在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>
工作文件
您不應該將此代碼放在index.html中,它不起作用,應該在組件中。
routerLink是這樣的:
routerLink="/Profile"
所以保持它像:
<a routerLink="/Profile" routerLinkActive="active">
有關更多詳細信息,請閱讀:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.