How to determine the active route in Angular? Detecting the active URL and highlighting links
Hello everyone! I'm new to Angular (version 15) and trying to make a navigation menu with active item highlighting. I have a component with several links:
```typescript
// navigation.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-navigation',
template: `
`
})
export class NavigationComponent {}
```
I want the active link to receive the `active` CSS class (e.g., bold font or different color). I tried using `routerLinkActive` — it seems to work, but not exactly as I expect. Sometimes multiple links get highlighted at the same time, especially when I have
No answers yet.
Log in to leave an answer
Blogs