change component styles outside my current component area
Before I say anything else, this is very discouraging. Components should be standalone objects that can be reused in your project or even in other projects. By creating a component that changes something else in the system only through CSS, you create a tight connection that is difficult to see from the code immediately, which leads to complex debugging of errors and other errors.
If you want to change yours app-nav
(or main-nav
, as you will find later, I'm not sure if this is my mistake) based on the current route, you must do this by entering ActivatedRoute
and querying it to determine the specific version of the header you want.
- , , .
, ,
routerLink <
, DOM , , , . Angular , , . .
(, css / - / )
.