angular/packages/core/schematics/migrations/router-current-navigation
Alan Agius 3bed9f0f16
build: format md files
This commit configures prettier to format markdown files.
2025-11-06 10:07:13 -08:00
..
BUILD.bazel refactor(compiler-cli): Remove deep imports of compiler-cli in angular/core 2025-10-28 15:58:59 +01:00
index.ts feat(router): add a currentNavigation signal to the Router service. (#63011) 2025-08-06 09:54:53 -07:00
README.md build: format md files 2025-11-06 10:07:13 -08:00
router_current_navigation_migration.ts feat(router): add a currentNavigation signal to the Router service. (#63011) 2025-08-06 09:54:53 -07:00

Remove Router.getCurrentNavigation migration

Replaces the usages of the deprecated Router.getCurrentNavigation method with the new Router.currentNavigation() signal:

Before

import { Router } from '@angular/router';

export class MyService {
  router = inject(Router);

  someMethod() {
    const currentNavigation = this.router.getCurrentNavigation();
  }
}

After

import { Router } from '@angular/router';

export class MyService {
  router = inject(Router);

  someMethod() {
    const currentNavigation = this.router.currentNavigation();
  }
}