How to set Bootstrap navbar “active” class in Angular 2?

后端 未结 11 662
被撕碎了的回忆
被撕碎了的回忆 2020-12-07 18:36

How can I set Bootstrap navbar \"active\" class in Angular 2? I only found Angular 1 way.

When I go to About page, add class=\"active\"

11条回答
  •  春和景丽
    2020-12-07 19:09

    In "@angular/router": "^3.3.1", the difference in the previous version is the bracket in the routerLinkActive

    [routerLinkActive]="['active']"
    

    In final release, ng2 will complain so just remove the bracket

    routerLinkActive="active"
    

提交回复
热议问题