angular/packages/core/schematics/migrations/router-current-navigation
Matthieu Riegler 6270bba056 ci: reformat files
This is after we've slightly changed a rule in #66056
2025-12-16 14:44:19 -08:00
..
BUILD.bazel refactor(compiler-cli): Remove deep imports of compiler-cli in angular/core 2025-10-28 15:58:56 +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 ci: reformat files 2025-12-16 14:44:19 -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();
  }
}