我有一些代码,如下所示 导航=>
<nav class="navpart">
<div class="container">
<div class="row">
<div class="col-md-6 col-sm-6">
<div class="menus">
<ul class="nav nav-pills">
<li routerLinkActive="active" class="active"><a routerLink="/home">Home</a></li>
<li routerLinkActive="active"><a routerLink="/product">Product</a></li>
<li routerLinkActive="active"><a routerLink="/service">Services</a></li>
<li routerLinkActive="active"><a routerLink="/about">About Us</a></li>
</ul>
</div>
</div>
<div class="col-md-6 col-sm-6"></div>
</div>
</div>
</nav>
<router-outlet></router-outlet>
App.module =&GT;
RouterModule.forRoot([
{path:"",component:HomeComponent},
{path:"home",component:HomeComponent},
{path:"product",component:ProductComponent},
{path:"service",component:ServiceComponent},
{path:"about",component:AboutComponent},
{path:"**",component:NotFoundComponent}
])
我将主页设置为localhost:4200以及localhost:4200 / home的视图 当url如localhost:4200以及localhost:4200 / home时,如何为Home routerLink设置活动类 提前致谢