From 4debb543527554431aa0b7272a0e7bfa3cc7ca57 Mon Sep 17 00:00:00 2001 From: Kristof De Langhe Date: Fri, 15 Nov 2019 16:00:33 +0100 Subject: [PATCH] AoT build errorfix - moving url matcher to exported function --- .../lookup-by-id-routing.module.ts | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/src/app/+lookup-by-id/lookup-by-id-routing.module.ts b/src/app/+lookup-by-id/lookup-by-id-routing.module.ts index 5ad3c2fd82..71865dd6c6 100644 --- a/src/app/+lookup-by-id/lookup-by-id-routing.module.ts +++ b/src/app/+lookup-by-id/lookup-by-id-routing.module.ts @@ -8,25 +8,7 @@ import { hasValue, isNotEmpty } from '../shared/empty.util'; imports: [ RouterModule.forChild([ { - matcher: (url) => { - // The expected path is :idType/:id - const idType = url[0].path; - // Allow for handles that are delimited with a forward slash. - const id = url - .slice(1) - .map((us: UrlSegment) => us.path) - .join('/'); - if (isNotEmpty(idType) && isNotEmpty(id)) { - return { - consumed: url, - posParams: { - idType: new UrlSegment(idType, {}), - id: new UrlSegment(id, {}) - } - }; - } - return null; - }, + matcher: urlMatcher, canActivate: [LookupGuard], component: ObjectNotFoundComponent } ]) @@ -39,3 +21,23 @@ import { hasValue, isNotEmpty } from '../shared/empty.util'; export class LookupRoutingModule { } + +export function urlMatcher(url) { + // The expected path is :idType/:id + const idType = url[0].path; + // Allow for handles that are delimited with a forward slash. + const id = url + .slice(1) + .map((us: UrlSegment) => us.path) + .join('/'); + if (isNotEmpty(idType) && isNotEmpty(id)) { + return { + consumed: url, + posParams: { + idType: new UrlSegment(idType, {}), + id: new UrlSegment(id, {}) + } + }; + } + return null; +}