@angular/router 21.0.0-next.2 → 21.0.0-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/router.mjs +2 -2
- package/fesm2022/router.mjs.map +1 -1
- package/fesm2022/router2.mjs +60 -56
- package/fesm2022/router2.mjs.map +1 -1
- package/fesm2022/router_module.mjs +34 -31
- package/fesm2022/router_module.mjs.map +1 -1
- package/fesm2022/testing.mjs +11 -11
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/upgrade.mjs +4 -4
- package/fesm2022/upgrade.mjs.map +1 -1
- package/index.d.ts +1 -1
- package/package.json +4 -4
- package/router_module.d.d.ts +4 -1
- package/testing/index.d.ts +1 -1
- package/upgrade/index.d.ts +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v21.0.0-next.
|
|
2
|
+
* @license Angular v21.0.0-next.4
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import * as i3 from '@angular/common';
|
|
8
8
|
import { LOCATION_INITIALIZED, ViewportScroller, LocationStrategy, HashLocationStrategy, Location, PathLocationStrategy } from '@angular/common';
|
|
9
9
|
import * as i0 from '@angular/core';
|
|
10
|
-
import { signal, untracked, inject, ɵINTERNAL_APPLICATION_ERROR_HANDLER as _INTERNAL_APPLICATION_ERROR_HANDLER, HostAttributeToken, ɵRuntimeError as _RuntimeError, booleanAttribute, Directive, Attribute, HostBinding, Input, HostListener, EventEmitter, Optional, ContentChildren, Output, Injectable, createEnvironmentInjector, InjectionToken, ɵpublishExternalGlobalUtil as _publishExternalGlobalUtil, makeEnvironmentProviders, APP_BOOTSTRAP_LISTENER, Injector, ApplicationRef, ɵIS_ENABLED_BLOCKING_INITIAL_NAVIGATION as _IS_ENABLED_BLOCKING_INITIAL_NAVIGATION, provideAppInitializer, ɵperformanceMarkFeature as _performanceMarkFeature, ENVIRONMENT_INITIALIZER, NgZone,
|
|
10
|
+
import { signal, untracked, inject, ɵINTERNAL_APPLICATION_ERROR_HANDLER as _INTERNAL_APPLICATION_ERROR_HANDLER, HostAttributeToken, ɵRuntimeError as _RuntimeError, booleanAttribute, Directive, Attribute, HostBinding, Input, HostListener, EventEmitter, Optional, ContentChildren, Output, Injectable, createEnvironmentInjector, InjectionToken, ɵpublishExternalGlobalUtil as _publishExternalGlobalUtil, makeEnvironmentProviders, APP_BOOTSTRAP_LISTENER, Injector, ApplicationRef, ɵIS_ENABLED_BLOCKING_INITIAL_NAVIGATION as _IS_ENABLED_BLOCKING_INITIAL_NAVIGATION, provideAppInitializer, ɵperformanceMarkFeature as _performanceMarkFeature, ENVIRONMENT_INITIALIZER, NgZone, NgModule } from '@angular/core';
|
|
11
11
|
import { ROUTER_CONFIGURATION, NavigationEnd, isUrlTree, Router, ActivatedRoute, RouterConfigLoader, IMPERATIVE_NAVIGATION, NavigationStart, NavigationSkipped, NavigationSkippedCode, Scroll, UrlSerializer, NavigationTransitions, ROUTES, afterNextNavigation, stringifyEvent, NAVIGATION_ERROR_HANDLER, RoutedComponentInputBinder, INPUT_BINDER, CREATE_VIEW_TRANSITION, createViewTransition, VIEW_TRANSITION_OPTIONS, DefaultUrlSerializer, ChildrenOutletContexts, RouterOutlet, ɵEmptyOutletComponent as _EmptyOutletComponent } from './router2.mjs';
|
|
12
12
|
import { Subject, of, from } from 'rxjs';
|
|
13
13
|
import { mergeAll, catchError, filter, concatMap, mergeMap } from 'rxjs/operators';
|
|
@@ -284,7 +284,7 @@ class RouterLink {
|
|
|
284
284
|
this.queryParamsHandling ||
|
|
285
285
|
this.preserveFragment ||
|
|
286
286
|
this.relativeTo)) {
|
|
287
|
-
throw new _RuntimeError(
|
|
287
|
+
throw new _RuntimeError(4017 /* RuntimeErrorCode.INVALID_ROUTER_LINK_INPUTS */, 'Cannot configure queryParams or fragment when using a UrlTree as the routerLink input value.');
|
|
288
288
|
}
|
|
289
289
|
if (this.isAnchorElement) {
|
|
290
290
|
this.updateHref();
|
|
@@ -387,10 +387,10 @@ class RouterLink {
|
|
|
387
387
|
preserveFragment: this.preserveFragment,
|
|
388
388
|
});
|
|
389
389
|
}
|
|
390
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
391
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "
|
|
390
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0-next.4", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
|
|
391
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "21.0.0-next.4", type: RouterLink, isStandalone: true, selector: "[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", state: "state", info: "info", relativeTo: "relativeTo", preserveFragment: ["preserveFragment", "preserveFragment", booleanAttribute], skipLocationChange: ["skipLocationChange", "skipLocationChange", booleanAttribute], replaceUrl: ["replaceUrl", "replaceUrl", booleanAttribute], routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.href": "reactiveHref()", "attr.target": "this.target" } }, usesOnChanges: true, ngImport: i0 });
|
|
392
392
|
}
|
|
393
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
393
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0-next.4", ngImport: i0, type: RouterLink, decorators: [{
|
|
394
394
|
type: Directive,
|
|
395
395
|
args: [{
|
|
396
396
|
selector: '[routerLink]',
|
|
@@ -505,6 +505,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2",
|
|
|
505
505
|
* <a routerLink="/" routerLinkActive="active" ariaCurrentWhenActive="page">Home Page</a>
|
|
506
506
|
* ```
|
|
507
507
|
*
|
|
508
|
+
* NOTE: RouterLinkActive is a `ContentChildren` query.
|
|
509
|
+
* Content children queries do not retrieve elements or directives that are in other components' templates, since a component's template is always a black box to its ancestors.
|
|
510
|
+
*
|
|
508
511
|
* @ngModule RouterModule
|
|
509
512
|
*
|
|
510
513
|
* @publicApi
|
|
@@ -646,10 +649,10 @@ class RouterLinkActive {
|
|
|
646
649
|
const isActiveCheckFn = this.isLinkActive(this.router);
|
|
647
650
|
return (this.link && isActiveCheckFn(this.link)) || this.links.some(isActiveCheckFn);
|
|
648
651
|
}
|
|
649
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
650
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
652
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0-next.4", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
653
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.0-next.4", type: RouterLinkActive, isStandalone: true, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
|
|
651
654
|
}
|
|
652
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
655
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0-next.4", ngImport: i0, type: RouterLinkActive, decorators: [{
|
|
653
656
|
type: Directive,
|
|
654
657
|
args: [{
|
|
655
658
|
selector: '[routerLinkActive]',
|
|
@@ -700,10 +703,10 @@ class PreloadAllModules {
|
|
|
700
703
|
preload(route, fn) {
|
|
701
704
|
return fn().pipe(catchError(() => of(null)));
|
|
702
705
|
}
|
|
703
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
704
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
706
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0-next.4", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
707
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0-next.4", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
|
|
705
708
|
}
|
|
706
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
709
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0-next.4", ngImport: i0, type: PreloadAllModules, decorators: [{
|
|
707
710
|
type: Injectable,
|
|
708
711
|
args: [{ providedIn: 'root' }]
|
|
709
712
|
}] });
|
|
@@ -720,10 +723,10 @@ class NoPreloading {
|
|
|
720
723
|
preload(route, fn) {
|
|
721
724
|
return of(null);
|
|
722
725
|
}
|
|
723
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
724
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
726
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0-next.4", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
727
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0-next.4", ngImport: i0, type: NoPreloading, providedIn: 'root' });
|
|
725
728
|
}
|
|
726
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
729
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0-next.4", ngImport: i0, type: NoPreloading, decorators: [{
|
|
727
730
|
type: Injectable,
|
|
728
731
|
args: [{ providedIn: 'root' }]
|
|
729
732
|
}] });
|
|
@@ -819,10 +822,10 @@ class RouterPreloader {
|
|
|
819
822
|
}
|
|
820
823
|
});
|
|
821
824
|
}
|
|
822
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
823
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
825
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0-next.4", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
826
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0-next.4", ngImport: i0, type: RouterPreloader, providedIn: 'root' });
|
|
824
827
|
}
|
|
825
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
828
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0-next.4", ngImport: i0, type: RouterPreloader, decorators: [{
|
|
826
829
|
type: Injectable,
|
|
827
830
|
args: [{ providedIn: 'root' }]
|
|
828
831
|
}], ctorParameters: () => [{ type: Router }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }] });
|
|
@@ -931,10 +934,10 @@ class RouterScroller {
|
|
|
931
934
|
this.routerEventsSubscription?.unsubscribe();
|
|
932
935
|
this.scrollEventsSubscription?.unsubscribe();
|
|
933
936
|
}
|
|
934
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
935
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
937
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0-next.4", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
938
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0-next.4", ngImport: i0, type: RouterScroller });
|
|
936
939
|
}
|
|
937
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
940
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0-next.4", ngImport: i0, type: RouterScroller, decorators: [{
|
|
938
941
|
type: Injectable
|
|
939
942
|
}], ctorParameters: () => [{ type: UrlSerializer }, { type: NavigationTransitions }, { type: i3.ViewportScroller }, { type: i0.NgZone }, { type: undefined }] });
|
|
940
943
|
|
|
@@ -1009,13 +1012,13 @@ function provideRouter(routes, ...features) {
|
|
|
1009
1012
|
typeof ngDevMode === 'undefined' || ngDevMode
|
|
1010
1013
|
? { provide: ROUTER_IS_PROVIDED, useValue: true }
|
|
1011
1014
|
: [],
|
|
1012
|
-
{ provide: ActivatedRoute, useFactory: rootRoute
|
|
1015
|
+
{ provide: ActivatedRoute, useFactory: rootRoute },
|
|
1013
1016
|
{ provide: APP_BOOTSTRAP_LISTENER, multi: true, useFactory: getBootstrapListener },
|
|
1014
1017
|
features.map((feature) => feature.ɵproviders),
|
|
1015
1018
|
]);
|
|
1016
1019
|
}
|
|
1017
|
-
function rootRoute(
|
|
1018
|
-
return
|
|
1020
|
+
function rootRoute() {
|
|
1021
|
+
return inject(Router).routerState.root;
|
|
1019
1022
|
}
|
|
1020
1023
|
/**
|
|
1021
1024
|
* Helper function to create an object that represents a Router feature.
|
|
@@ -1518,7 +1521,7 @@ const ROUTER_PROVIDERS = [
|
|
|
1518
1521
|
{ provide: UrlSerializer, useClass: DefaultUrlSerializer },
|
|
1519
1522
|
Router,
|
|
1520
1523
|
ChildrenOutletContexts,
|
|
1521
|
-
{ provide: ActivatedRoute, useFactory: rootRoute
|
|
1524
|
+
{ provide: ActivatedRoute, useFactory: rootRoute },
|
|
1522
1525
|
RouterConfigLoader,
|
|
1523
1526
|
// Only used to warn when `provideRoutes` is used without `RouterModule` or `provideRouter`. Can
|
|
1524
1527
|
// be removed when `provideRoutes` is removed.
|
|
@@ -1586,7 +1589,6 @@ class RouterModule {
|
|
|
1586
1589
|
? {
|
|
1587
1590
|
provide: ROUTER_FORROOT_GUARD,
|
|
1588
1591
|
useFactory: provideForRootGuard,
|
|
1589
|
-
deps: [[Router, new Optional(), new SkipSelf()]],
|
|
1590
1592
|
}
|
|
1591
1593
|
: [],
|
|
1592
1594
|
config?.errorHandler
|
|
@@ -1628,11 +1630,11 @@ class RouterModule {
|
|
|
1628
1630
|
providers: [{ provide: ROUTES, multi: true, useValue: routes }],
|
|
1629
1631
|
};
|
|
1630
1632
|
}
|
|
1631
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1632
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
1633
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
1633
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0-next.4", ngImport: i0, type: RouterModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1634
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.0.0-next.4", ngImport: i0, type: RouterModule, imports: [RouterOutlet, RouterLink, RouterLinkActive, _EmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkActive, _EmptyOutletComponent] });
|
|
1635
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.0.0-next.4", ngImport: i0, type: RouterModule });
|
|
1634
1636
|
}
|
|
1635
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1637
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0-next.4", ngImport: i0, type: RouterModule, decorators: [{
|
|
1636
1638
|
type: NgModule,
|
|
1637
1639
|
args: [{
|
|
1638
1640
|
imports: ROUTER_DIRECTIVES,
|
|
@@ -1669,7 +1671,8 @@ function provideHashLocationStrategy() {
|
|
|
1669
1671
|
function providePathLocationStrategy() {
|
|
1670
1672
|
return { provide: LocationStrategy, useClass: PathLocationStrategy };
|
|
1671
1673
|
}
|
|
1672
|
-
function provideForRootGuard(
|
|
1674
|
+
function provideForRootGuard() {
|
|
1675
|
+
const router = inject(Router, { optional: true, skipSelf: true });
|
|
1673
1676
|
if (router) {
|
|
1674
1677
|
throw new _RuntimeError(4007 /* RuntimeErrorCode.FOR_ROOT_CALLED_TWICE */, `The Router was provided more than once. This can happen if 'forRoot' is used outside of the root injector.` +
|
|
1675
1678
|
` Lazy loaded modules should use RouterModule.forChild() instead.`);
|