From 93d548fba4dc0570fb510b91c466ce3bd3ad92ac Mon Sep 17 00:00:00 2001 From: portneon Date: Sun, 16 Nov 2025 10:35:07 +0530 Subject: [PATCH] docs(router): update navigation event example to use event.code --- adev/src/content/guide/routing/lifecycle-and-events.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/adev/src/content/guide/routing/lifecycle-and-events.md b/adev/src/content/guide/routing/lifecycle-and-events.md index 3945f356be6..c0b507f515e 100644 --- a/adev/src/content/guide/routing/lifecycle-and-events.md +++ b/adev/src/content/guide/routing/lifecycle-and-events.md @@ -151,6 +151,7 @@ Handle navigation errors gracefully and provide user feedback: ```angular-ts import { Component, inject, signal } from '@angular/core'; import { Router, NavigationStart, NavigationError, NavigationCancel, NavigationCancellationCode } from '@angular/router'; +import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; @Component({ selector: 'app-error-handler', @@ -176,7 +177,7 @@ export class ErrorHandlerComponent { this.errorMessage.set('Failed to load page. Please try again.'); } else if (event instanceof NavigationCancel) { console.warn('Navigation cancelled:', event.reason); - if (event.reason === NavigationCancellationCode.GuardRejected) { + if (event.code === NavigationCancellationCode.GuardRejected) { this.errorMessage.set('Access denied. Please check your permissions.'); } }