
Angular Router
- 170 installs
- 6 repo stars
- Updated April 4, 2026
- oguzhan18/angular-ecosystem-skills
Designing routes, lazy loading, guards, outlets, parameterized URLs, and deep-linking behavior for multi-view Angular single-page applications.
About
Provides Angular Router guidance for lazy-loaded feature modules, functional guards, parameterized routes, auxiliary outlets, and testing strategies for reliable SPA navigation.
- Standalone route configuration
- Lazy loading and preloading
- CanActivate and CanMatch guards
- Named outlets and auxiliary routes
- Router testing and URL serializer
Angular Router by the numbers
- 170 all-time installs (skills.sh)
- +1 installs in the week ending Aug 4, 2026 (Skillselion tracking)
- Ranked #921 of 2,245 Frontend Development skills by installs in the Skillselion catalog
- Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/oguzhan18/angular-ecosystem-skills --skill angular-routerAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 170 |
|---|---|
| repo stars | ★ 6 |
| Last updated | April 4, 2026 |
| Repository | oguzhan18/angular-ecosystem-skills ↗ |
What it does
Designing routes, lazy loading, guards, outlets, parameterized URLs, and deep-linking behavior for multi-view Angular single-page applications.
Files
@angular/router
Version: Angular 21 (2025) Tags: Routing, Navigation, Guards, Lazy Loading, SPA
References: Docs — official routing guide • API • GitHub
API Changes
This section documents recent version-specific API changes.
- NEW: Functional guards and resolvers — Prefer functional approach over class-based guards source
- NEW: Router inputs — New way to pass data to components via route inputs source
- NEW: withComponentInputBinding — Enable component input binding from route params
- NEW: Router snapshots improvement — Better type safety for route parameters
- NEW: provideRouter() — Modern router configuration with functional providers
- DEPRECATED: RouterModule.forRoot() — Use provideRouter() in modern applications
Best Practices
- Use lazy loading for feature modules — Reduce initial bundle size by 50-70%
const routes: Routes = [
{
path: 'dashboard',
loadChildren: () => import('./dashboard/dashboard.routes').then(m => m.DASHBOARD_ROUTES)
}
];- Use functional guards over class-based guards
// ✅ Modern functional guard
const authGuard = () => {
const authService = inject(AuthService);
const router = inject(Router);
if (authService.isAuthenticated()) {
return true;
}
return router.createUrlTree(['/login']);
};
// ❌ Avoid class-based guards for new code
// @Injectable() export class AuthGuard implements CanActivate { ... }- Use CanMatch guard for lazy-loaded routes — Prevents unauthorized code downloads
{
path: 'admin',
canMatch: [authGuard],
loadComponent: () => import('./admin/admin.component').then(m => m.AdminComponent)
}- Use resolvers for pre-fetching data — Eliminates loading spinners
{
path: 'user/:id',
resolve: { user: userResolver }
}
// In component
@Component({})
export class UserComponent {
private route = inject(ActivatedRoute);
// Modern way
user = input.required<User>();
// Legacy way
ngOnInit() {
this.route.data.subscribe(data => {
this.user = data['user'];
});
}
}- Use router inputs for better type safety
// app.config.ts
export const appConfig: ApplicationConfig = {
providers: [
provideRouter(routes, withComponentInputBinding())
]
};
// Component receives route params as inputs
@Component({})
export class UserComponent {
@Input() id!: string;
}- Use wildcard routes for 404 pages
{
path: '**',
component: NotFoundComponent
}- Use PreloadAllModules for background loading
provideRouter(routes, withPreloading(PreloadAllModules))- Use routerLink for navigation — Maintains SPA behavior
// ✅ Correct
<a routerLink="/dashboard">Dashboard</a>
// ❌ Wrong - causes full page reload
<a href="/dashboard">Dashboard</a>- Use kebab-case for URL paths — Consistent naming convention
// ✅ Good
{ path: 'user-profile', ... }
// ❌ Avoid
{ path: 'userProfile', ... }Docs Reference Index
Official Documentation
- Angular Routing Guide - Main documentation
- Router API
- Router Tutorial
- Route Guards
- Lazy Loading