opencode-agent-kit
Version:
Multi-stack OpenCode agent toolkit — 33+ specialized AI agents, 200+ skills, 46 commands, 8 MCP servers (Nuxt, React, Node.js, Laravel, CI3, Android, Flutter, DevOps, SEO, SonarQube, and more)
70 lines (49 loc) • 1.64 kB
Markdown
Angular provides both declarative and programmatic ways to navigate between routes.
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.
Inject the `Router` service to navigate via TypeScript code.
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 });
```
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});
```
- **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`).