简体   繁体   English

角度:使用RouterLinkActive的子路由不起作用

[英]Angular: child routes using RouterLinkActive not working

Something that should be 'easy' takes me already more than one hour... And I'm pretty stuck now. 应该“轻松”的事情已经使我花费了一个多小时……而且我现在很困。 I just want to add a 'red' color when the 'child' router link becomes 'active'. 我只想在“子”路由器链接变为“活动”时添加“红色”颜色。 See the link below: 请参阅下面的链接:

https://stackblitz.com/edit/angular-pm9tdb https://stackblitz.com/edit/angular-pm9tdb

What am I doing wrong? 我究竟做错了什么?

The link has its own color defined, which takes precedence over the color of its ancestor class. 链接具有自己定义的颜色,该颜色优先于其祖先类的颜色。 So your selector should be 所以你的选择器应该是

.active a

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM