4

Facing problem while child routing in angular2 that how to highlight the active route. i know for parent routing we can use

routerLinkActive="active"

but in case of child routing i have to highlight parent as well as child route both. how to do this ?

referring from here

Community
  • 1
  • 1
Pardeep Jain
  • 84,110
  • 37
  • 165
  • 215

1 Answers1

6

In fact you don't have to use [routerLinkActiveOptions]="{ exact: true }" anywhere. Just use routerLinkActive="active". This way you will be able to see parent and its child route active at a same time.

For further reference : https://plnkr.co/edit/UoojNRslgeqfkF83Qgym?p=preview - check contact route.

micronyks
  • 54,797
  • 15
  • 112
  • 146
  • yes i know but if i am not using `...exact:true...` than some problems occur see this http://stackoverflow.com/q/38673498/5043867 – Pardeep Jain Aug 08 '16 at 08:49
  • I can only help you with your plunker. I feel like you must have missed something somewhere. You can check my plunker its working as expected with RC.4. – micronyks Aug 08 '16 at 08:52
  • yes you are right but i am unable to produce the same problem on plunker right now :( is there any other option there for the same ? – Pardeep Jain Aug 08 '16 at 08:54
  • 1
    I'm not sure but lookin at your other question, I feel like you have some problem with `routerLink`. I'm not sure though. You can check and compare with my plunker and hopefully it will work. – micronyks Aug 08 '16 at 08:56