2017-03-03 74 views
0

我在导航激活按钮中有borderbottom行。 我的链接是ex。 http://localhost:3000/#/dashboard/wageAngular 2,子菜单仅在一个活动子菜单中需要borderbottom

与此代码,我有活跃的2个按钮与bottomborder - 仪表板和工资

CSS:

.sub-navbar li a:active { 
color: white; 
border-bottom: 4px solid #9ACD32; 
background-color: #002b31; 

}

<li *ngFor="let sub of nav.subMenu"> 
        <a [routerLink]="'/dashboard' + [sub.link]" [routerLinkActive]="['is-active']"> 
         {{sub.name}} 
        </a> 
       </li> 

回答

0

我认为你造型的它的那样简单a element有一个名为'active'的类:a:active。但是您的路由器链接正在设置一个名为is-active的类。尝试将其设置为active

<a [routerLink]="'/dashboard' + [sub.link]" [routerLinkActive]="['active']"> 
+0

不需要..我们只需要获得儿童链接并做主动,而不是+仪表板 –

+0

@AgonFejza什么? –