Angular:使用 RouterLinkActive 的子路由不工作
Angular: child routes using RouterLinkActive not working
本来应该是 'easy' 的事情我已经花了一个多小时...而且我现在很困。我只想在 'child' 路由器 link 变为 'active' 时添加 'red' 颜色。请参阅下面的 link:
https://stackblitz.com/edit/angular-pm9tdb
我做错了什么?
link 定义了自己的颜色,优先于其祖先 class 的颜色。所以你的选择器应该是
.active a
本来应该是 'easy' 的事情我已经花了一个多小时...而且我现在很困。我只想在 'child' 路由器 link 变为 'active' 时添加 'red' 颜色。请参阅下面的 link:
https://stackblitz.com/edit/angular-pm9tdb
我做错了什么?
link 定义了自己的颜色,优先于其祖先 class 的颜色。所以你的选择器应该是
.active a