Skip to content

Commit 36c2f4b

Browse files
SkyZeroZxthePunderWoman
authored andcommitted
docs(docs-infra): replace deprecated Router.isActive with isActive (angular#66430)
Updates the view transition logic to use the isActive function instead of the deprecated Router.isActive PR Close angular#66430
1 parent a39e3fd commit 36c2f4b

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

adev/src/app/routing/router_providers.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
RedirectCommand,
2323
withNavigationErrorHandler,
2424
withRouterConfig,
25+
isActive,
2526
} from '@angular/router';
2627
import {routes} from './routes';
2728
import {ADevTitleStrategy} from '../core/services/a-dev-title-strategy';
@@ -51,14 +52,14 @@ export const routerProviders = [
5152
const router = inject(Router);
5253
const toTree = createUrlTreeFromSnapshot(to, []);
5354
// Skip the transition if the only thing changing is the fragment and queryParams
54-
if (
55-
router.isActive(toTree, {
56-
paths: 'exact',
57-
matrixParams: 'exact',
58-
fragment: 'ignored',
59-
queryParams: 'ignored',
60-
})
61-
) {
55+
const isTargetRouteCurrent = isActive(toTree, router, {
56+
paths: 'exact',
57+
matrixParams: 'exact',
58+
fragment: 'ignored',
59+
queryParams: 'ignored',
60+
});
61+
62+
if (isTargetRouteCurrent()) {
6263
transition.skipTransition();
6364
}
6465
},

0 commit comments

Comments
 (0)