import { Component } from '@angular/core'; import { inject } from '@angular/core'; import { ActivatedRoute, RouterLink, RouterOutlet, Routes } from '@angular/router'; import { toSignal } from '@angular/core/rxjs-interop'; import { map } from 'rxjs'; @Component({ selector: 'bh-route-parameters-part-0', standalone: true, template: '
Tool {{ code() }}
', }) class ToolPage { private route = inject(ActivatedRoute); code = toSignal( this.route.paramMap.pipe(map((params) => params.get('code') ?? 'Missing')), { initialValue: 'Missing' }, ); } export const routes: Routes = [ { path: '', redirectTo: 'tools/DR-4', pathMatch: 'full' }, { path: 'tools/:code', component: ToolPage }, ]; @Component({ selector: 'bh-route-parameters', standalone: true, imports: [RouterLink, RouterOutlet], template: `Drill Clamp