oberconcejo/VS-CODE / .agents/skills/angular-developer
angular-developer
VerifiedGenerates Angular code and provides architectural guidance. Trigger when creating projects, components, or services, or for best practices on reactivity (signals, linkedSignal, resource), forms, dependency injection, routing, SSR, accessibility (ARIA), animations, styling (component styles, Tailwind CSS), testing, or CLI tooling.
references/navigate-to-routes.md
View on GitHub# Navigate to Routes
Angular provides both declarative and programmatic ways to navigate between routes.
## Declarative Navigation (`RouterLink`)
Use the `RouterLink` directive on anchor elements.
```ts
import {RouterLink, RouterLinkActive} from '@angular/router';
@Component({
imports: [RouterLink, RouterLinkActive],
template: `
<nav>
<a routerLink="/dashboard" routerLinkActive="active-link">Dashboard</a>
<a [routerLink]="['/user', userId]">Profile</a>
</nav>
`,
})
export class Nav {
userId = '123';
}
```
- **Absolute Paths**: Start with `/` (e.g., `/settings`).
- **Relative Paths**: No leading `/`. Use `../` to go up a level.
## Programmatic Navigation (`Router`)
Inject the `Router` service to navigate via TypeScript code.
### `router.navigate()`
Uses an array of commands.
```ts
private router = inject(Router);
private route = inject(ActivatedRoute);
// Standard navigation
this.router.navigate(['/profile']);
// With parameters
this.router.navigate(['/search'], {
queryParams: { q: 'angular' },
fragment: 'results'
});
// Relative navigation
this.router.navigate(['edit'], { relativeTo: this.route });
```
### `router.navigateByUrl()`
Uses a string path. Ideal for absolute navigation or full URLs.
```ts
this.router.navigateByUrl('/products/123?view=details');
// Replace current entry in history
this.router.navigateByUrl('/login', {replaceUrl: true});
```
## URL Parameters
- **Route Params**: Part of the path (e.g., `/user/123`).
- **Query Params**: After the `?` (e.g., `/search?q=query`).
- **Matrix Params**: Scoped to a segment (e.g., `/products;category=books`).
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |