How to set bootstrap navbar active class with Angu

2019-01-02 16:32发布

If I have a navbar in bootstrap with the items

Home | About | Contact

How do I set the active class for each menu item when they are active? That is, how can I set class="active" when the angular route is at

  1. #/ for home
  2. #/about for the about page
  3. #/contact for the contact page

25条回答
骚的不知所云
2楼-- · 2019-01-02 17:13

Just you'll have to add the required active-class with required color code.

Ex: ng-class="{'active': currentNavSelected}" ng-click="setNav"

登录 后发表回答