0

I have two simple pages: Home and About. I also have a menu array in my AppComponent:

menu = [
  {path: '', title: 'Home'},
  {path: 'about', title: 'About'}
];

Styles:

.active {
  color: red;
}

.blue {
  color: blue;
}

And View:

<ul>
  <li *ngFor="let item of menu" [routerLink]="item.path" routerLinkActive="active"
      [routerLinkActiveOptions]="{exact: true}">
    <span routerLinkActive="blue">+</span>{{item.title}}
  </li>
</ul>
<router-outlet></router-outlet>

When I'm navigating to the pages, I want link become red and plus sign become blue. But when I'm on the About page, Home link's plus sign is also blue:

Capture

What can I do? I cannot style plus sign in other way, only with routerLinkActive (in my real project everything is much more complicated).

Boris
  • 4,944
  • 7
  • 36
  • 69

0 Answers0