Current route
Access information about the active route via ICurrentRoute.
interface ICurrentRoute {
readonly path: string;
readonly url: string;
readonly title: string;
readonly query: URLSearchParams;
readonly parameterInformation: readonly ParameterInformation[];
}
interface ParameterInformation {
readonly config: RouteConfig | null;
readonly viewport: string | null;
readonly params: Readonly<Params> | null;
readonly children: readonly ParameterInformation[];
}import { ICurrentRoute } from '@aurelia/router';
import { resolve } from '@aurelia/kernel';
export class MyApp {
private readonly currentRoute = resolve(ICurrentRoute);
// ⚠️ Note: accessing in lifecycle hooks shows previous route
// See "Timing Considerations" below for proper solutions
}Timing Considerations
Component Lifecycle vs Router Timing
Incorrect Timing Examples
Correct Timing Solutions
Last updated
Was this helpful?