Skip to content

Commit 6edb908

Browse files
committedJan 8, 2025·
fix(@angular/ssr): throw error when using route matchers
Route matchers are not currently supported in Angular SSR. This commit ensures an error is issued when a route matcher is detected.
1 parent 8639a3b commit 6edb908

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed
 

‎packages/angular/ssr/src/routes/ng-routes.ts

+17-1
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,25 @@ async function* traverseRoutesConfig(options: {
144144

145145
for (const route of routes) {
146146
try {
147-
const { path = '', redirectTo, loadChildren, loadComponent, children, ɵentryName } = route;
147+
const {
148+
path = '',
149+
matcher,
150+
redirectTo,
151+
loadChildren,
152+
loadComponent,
153+
children,
154+
ɵentryName,
155+
} = route;
148156
const currentRoutePath = joinUrlParts(parentRoute, path);
149157

158+
if (matcher) {
159+
yield {
160+
error: `The route '${stripLeadingSlash(currentRoutePath)}' uses a route matcher which is not supported.`,
161+
};
162+
163+
continue;
164+
}
165+
150166
// Get route metadata from the server config route tree, if available
151167
let matchedMetaData: ServerConfigRouteTreeNodeMetadata | undefined;
152168
if (serverConfigRouteTree) {

0 commit comments

Comments
 (0)
Please sign in to comment.